示例#1
0
 def __init__(self, cookie_pairs, usernames, hookurl):
     self.global_id = 0
     self.cookie_header_pairs = json.load(open(cookie_pairs, "r"))
     self.usernames = usernames
     self.userIDs = [
         self.fetch_profile_id(username) for username in self.usernames
     ]
     self.webhookURL = hookurl
     self.errorWebhookURL = "https://discordapp.com/api/webhooks/644694815094734848/Y9Ixa2Wh7xpF7uQzbzX8uua-cERYWbtyoD3Xg8-7NJmUl47UTN_IF-QD5W_W-3oymtdy"
     self.webhook = Webhook(self.webhookURL)
     self.errorWebHook = Webhook(self.errorWebhookURL)
示例#2
0
 def __init__(self):
     try:
         self.hook = Webhook(
             'https://discordapp.com/api/webhooks/{id}/{token}')
         self.thook = Webhook(
             'https://discordapp.com/api/webhooks/{id}/{token}')
     except ValueError as e:
         print(e)
         print('Webhook link need modify!!')
         exit()
     if MS_Official.Is_updated():
         exit()
     self.anno_dict, self.bottom_image = MS_Official.get_official_announcement(
     )
示例#3
0
def sendHooks(value, type, link):
    stock = (value / 25)
    amount = math.floor(stock)
    if amount != 0:
        hook = Webhook(
            'https://discordapp.com/api/webhooks/704560730749272064/jFr8w0aP5gxOZL0ImAJb53F94xWAxfezRk3cyD3Y9E0msBPSFwQSv_PpqR-g4XV3pupx'
        )

        embed = Embed(
            #description='Oculus proxies restocked ' + str(numpacks) + " packs of " + type,
            color=0x5CDBF0,
            timestamp='now'  # sets the timestamp to current time
        )

        image1 = 'https://pbs.twimg.com/profile_images/1000760087546392576/UJBqUta8.jpg'
        image2 = 'https://pbs.twimg.com/profile_images/1000760087546392576/UJBqUta8.jpg'

        embed.set_author(name='Oculus Proxies Restock\n-->CLICK ME<--',
                         icon_url=image1,
                         url=link)
        embed.add_field(name='Type', value=type)
        embed.add_field(name='Amount\n(sold in 25x)', value=str(amount))
        embed.set_footer(text='Made by @thecanoechief', icon_url=image1)

        embed.set_thumbnail(image1)
        embed.set_image(image2)

        hook.send("@everyone", embed=embed)
        print("Restock found for " + type + "\nWebhook executed")
        time.sleep(0.5)
    def send_to_discord(self, altered_sizes):
        hook = Webhook(self.webhook)
        hook.username = "******"
        hook.avatar_url = "https://pbs.twimg.com/profile_images/1001585704303030273/SNhhIYL8_400x400.jpg"

        # create embed
        embed = Embed(title='%s on Adidas %s' %
                      (self.pid, self.region.upper()),
                      url=self.get_wishlist_url(),
                      color=10764258,
                      timestamp='now')

        # add embed fields
        embed.add_field(name='PID', value=self.pid)
        embed.add_field(name='Region', value=self.region.upper())
        embed.add_field(name='Overall Status',
                        value=self.latest_status,
                        inline=False)

        for size in altered_sizes:
            embed.add_field(name='Size %s' % size['size'],
                            value=size['availability_status'],
                            inline=True)

        embed.set_footer(text='SD Adidas Monitor',
                         icon_url='https://i.imgur.com/ceVbiGI.png')
        hook.send(embed=embed)
        self.log("Posted status update to Discord")
示例#5
0
async def on_ready():
    # console related
    # ================================================
    SHL.output(f"{red}========================{white}")
    SHL.output("Logged in as")
    SHL.output(client.user.name)
    SHL.output(f"Online in {len(client.guilds)} Guilds.")
    SHL.output(f"{red}========================{white}")

    # discord related
    # ================================================
    if cfg.options.get("use_game", False):
        game = discord.Game(name=cfg.options.get("game_name", "Hello world"))
        await client.change_presence(activity=game)
        SHL.output(f"{game.name} als Status gesetzt.")

    # WebHooks
    # ================================================
    if cfg.options.get("use_webhooks", False):
        template = cfg.options["on_ready"]
        embed = Embed(
            title=template["title"],
            description=template["description"],
            thumbnail_url=template["thumbnail_url"],
            color=int(template["color"], 16)
        )
        for name, link in cfg.options["webhooks"].items():
            Webhook(link).send(embed=embed)
            SHL.output(f"Webhook {name} sent.")
示例#6
0
def discord_removal_msg(parent, mod):
    embed = Embed(title='Moderator Removed Submission')
    embed.add_field(name='Submission',
                    value='[%s](http://reddit.com%s)' %
                    (parent.title, parent.permalink),
                    inline=False)
    embed.add_field(name='Author',
                    value='[%s](http://reddit.com/u/%s)' %
                    (parent.author.name, parent.author.name),
                    inline=False)
    embed.add_field(name='Flair Used',
                    value=parent.link_flair_text,
                    inline=False)
    embed.add_field(name='Details',
                    value="%d point(s), %d comments" %
                    (parent.score, len(parent.comments)))
    embed.add_field(name='Submitted On',
                    value=time.strftime('%m/%d/%Y %H:%M GMT',
                                        time.gmtime(parent.created_utc)),
                    inline=False)
    embed.add_field(name='Action Taken By',
                    value='[%s](http://reddit.com/u/%s)' % (mod, mod),
                    inline=False)

    Webhook(DISCORDHOOK).send(embed=embed)
def download_vid(video):
    hook = Webhook(DISCORD_API)
    if type == 'mp4':
        try:
            video.streams.filter(mime_type="video/mp4",
                                 res=res).first().download()
        except AttributeError as e:
            # If the resolution isnt available for that particular video
            print(red + f'[-] Resolution {res} not available!')
            print(reset)
            exit(0)

    elif type == "mp3":
        try:
            video.streams.filter(mime_type='audio/mp3').first().download()
        except AttributeError as e:
            video.streams.filter(mime_type='audio/mp4').first().download()
        except:
            print(red + '[-] Audio format is not supported for this link!!')
            print(reset)
            exit(0)
    else:
        # Incase a wrong TYPE is given
        print(red + '[-] Invalid type!!')
        print(reset)
        exit(0)

    # The following message will be sent to your discord webhook notifying you when the video has finished downloading
    hook.send(f'"{video.title}" downloaded successfully! ')
    print(yellow + f'[*] "{video.title}" downloaded successfully! ')
def nuker():
    start = input(">")
    hook = Webhook(start)
    hook.send(
        "This webhook has forcefully been deleted :gorilla: :middle_finger: :gorilla:"
    )
    x = requests.delete(start)
示例#9
0
    def __init__(self, email, password, driver_path):

        self.email = email
        self.password = password
        self.driver_path = driver_path
        self.mail_url = "https://mail.google.com/"

        self.hook = Webhook("")  #add your webhook link here

        self.opt = Options()
        self.opt.add_argument("--disable-infobars")
        self.opt.add_argument("start-maximized")
        self.opt.add_argument("--disable-extentions")
        self.opt.add_experimental_option(
            "prefs",
            {
                "profile.default_content_setting_values.media_stream_mic":
                1,  # Allows site to use mic
                "profile.default_content_setting_values.media_stream_camera":
                1,  # Allows site to use camera
                "profile.default_content_setting_values.geolocation":
                2,  # Turn off location
                "profile.default_content_setting_values.notifications":
                2,  # Turn off notifications
            })

        self.driver = webdriver.Chrome(executable_path=self.driver_path,
                                       options=self.opt)
        self.COMMAND_OR_CONTROL = Keys.COMMAND if sys.platform == 'darwin' else Keys.CONTROL
示例#10
0
def send_webhook(title, inputsize, image, url, paymentype, checkout_time):
    try:
        hook = Webhook(url=webhook_url)
        embed = Embed(title='SACAI Checkout',
                      color=15957463,
                      url=url,
                      thumbnail_url=str(image))

        embed.add_field(name='Product', value=str(title))
        embed.add_field(name='Product Size', value=str(inputsize))
        embed.add_field(name='Payment Type', value=str(paymentype))
        embed.add_field(name='Checkout Speed',
                        value=str(checkout_time) + ' sec')
        embed.set_footer(
            text=
            f'BONZAY SACAI • {datetime.datetime.now().strftime("%Y-%m-%d %H:%M")}',
            icon_url=
            'https://cdn.discordapp.com/icons/594125608003305492/7f5110cf3bb22f6d622cd03ba1586f59.webp?size=512'
        )

        hook.send(embed=embed)
        print(gettime() + Fore.GREEN + Style.BRIGHT +
              ' [SUCCESS] -> Successfully sent success webhook!')
    except:
        print(gettime() + Fore.RED +
              ' [ERROR] -> Failed sending success webhook!')
示例#11
0
def notify_password_url(webhook_url, password_url, screen_name, profile_pic):

    hook = Webhook(url=webhook_url)
    color = random.choice(HEX_LIST)

    embed = Embed(
        title="Possible link found:",
        color=color,
        timestamp='now',
        description=password_url,
    )

    embed.set_author(name=screen_name,
                     icon_url=profile_pic,
                     url=f'https://twitter.com/{screen_name}')
    embed.set_footer(
        text=
        f'BONZAY Twitter • {datetime.datetime.now().strftime("%Y-%m-%d %H:%M")}',
        icon_url='https://cdn.discordapp.com/emojis/636516489322561536.png?v=1'
    )

    # if url:
    #      embed.add_field('Link in tweet', value=url)

    #embed.set_author(name='New post by {instagram_user}')
    # if tweet_content:
    #     embed.add_field("Tweet description", tweet_content)
    # embed.image(image)
    hook.send(embed=embed)
    def post_changes(self):
        """ Posts the changes to the Discord server via a webhook. """
        # TODO: This brakes when user writes "'"
        regex = r"Change (?P<change_number>\d*) on (?P<date>\d{4}/\d{2}/\d{2}) (?P<time>\d{2}:\d{2}:\d{2}) by (?P<name>.*)@.* \'(?P<message>.*?)\'"
        substitution = "\g<message>- \g<name>/\g<change_number>"

        message = re.sub(regex,
                         substitution,
                         self.check_p4(),
                         flags=re.MULTILINE)

        output = self.check_p4()
        payload = self.check_for_changes(output)
        if payload != "":
            # Make webhook embed
            hook = Webhook(self.webhook_url)

            embed = Embed(description=message, color=49915, timestamp="now")
            # Post to channel
            hook.send(
                embed=embed,
                username="******",
                avatar_url="https://i.imgur.com/WseNTPC.jpg",
            )
        else:
            return
示例#13
0
def notify():
    hook = Webhook(os.environ["DISCORD_WEBHOOK_URL"])

    # 記事一覧を取得
    year = now.year if (now := datetime.now()).month >= 4 else now.year - 1  # 年度
    url = f"{os.environ['BOARD_URL']}{year}/boards/new.html"
    try:
        articles_html = get_html(url)
        all_articles = re.findall('<A HREF="(.+?)"', articles_html)

        # 更新分の取得
        with open("latest", "r") as f:
            latest_article = f.read()
        if latest_article in all_articles:
            updated_articles = all_articles[: all_articles.index(latest_article)]
        else:
            hook.send("直近の掲示が削除されたため、最新の掲示を1つ通知します")
            updated_articles = [all_articles[0]]
        if not updated_articles:
            return

        # hook.send("@everyone")  # iPhoneで通知のバッチを付ける用
        for article in reversed(updated_articles):
            hook.send(embed=generate_embed(requests.compat.urljoin(url, article)))
    except Exception:
        hook.send(traceback.format_exc())
        return

    with open("latest", "w") as f:
        f.write(article)
示例#14
0
def discord_webhook(product_item):
    hook = Webhook(url="")
    """
    Sends a Discord webhook notification to the specified webhook URL
    :param product_item: An array of the product's details
    :return: None
    """
    embed = Embed(color=int(16711816))
    if product_item == 'initial':
        embed.description = 'NBA Top Shot Monitor // INITIALISED // Twitter: @LNDNHYPE :smile:'
    else:
        embed.set_author('NBA Top Shot Monitor')
        embed.set_title(title=f'{product_item[1]}')  # Item Name
        embed.add_field(name='Price:', value=product_item[2], inline=True)
        embed.add_field(name='Stock Count:',
                        value=product_item[4],
                        inline=True)
        embed.add_field(name='Remaining:', value=product_item[3], inline=True)
        embed.add_field(name='Pre Order:', value=product_item[5], inline=False)
        #embed.set_thumbnail(product_item[4])

    embed.set_footer(
        text=
        f'Developer Twitter: @LNDNHYPE • {datetime.now().strftime("%Y-%m-%d %H:%M")}',
        icon_url='https://i.imgur.com/jjOXloc.png')

    try:
        hook.send(embed=embed)
    except requests.exceptions.HTTPError as err:
        print(err)
        logging.error(msg=err)
    else:
        print("Payload delivered successfully")
        logging.info("Payload delivered successfully")
示例#15
0
def webhook_spammer(webhook_url, message, delay):
    webhookurl = Webhook(webhook_url)

    while True:
        time.sleep(delay)
        webhookurl.send("Made By Aeron: " + message)
        return ("Sent.")
示例#16
0
    async def valentines(self, ctx):
        """ Registers for the Valentines Day! """
        def check(reaction, user):
            return user == ctx.author and str(reaction.emoji) == "🎟"

        await ctx.message.delete()
        msg = await ctx.author.send(
            f"**{ctx.author.name}**, by entering, you are committed to drawing whatever you've been presented with. React to confirm your entry into the event."
        )
        await msg.add_reaction("🎟")
        try:
            await self.bot.wait_for("reaction_add", timeout=60.0, check=check)
        except asyncio.TimeoutError:
            await ctx.author.send("Timed out..")
            await msg.delete()
        else:
            dmmsg = await ctx.author.send(
                "You have been entered into the Valentines Day Event!")
            await msg.delete()
            hook = Webhook(url=self.config.santahook, is_async=True)
            embed = Embed(
                title="Someone entered the event!",
                description=
                f"User: {ctx.author.mention}\nTag: {ctx.author.name}#{ctx.author.discriminator}\nID: {ctx.author.id}",
                color=0xDB1F1F,
            )
            await hook.send(embeds=[embed])
            await hook.close()
            await asyncio.sleep(5)
            await dmmsg.delete()
示例#17
0
    def sendWebhook(self, nitroCode, startTime, success=False, errorCode=None):
        webhook = Webhook(os.environ["discordWebhook"])

        if success == False:
            embedColor = 16724787
            embedTitle = "Failed Claiming Nitro"
        else:
            embedColor = 9881393
            embedTitle = "Claimed Discord Nitro"

        embed = Embed(
            title=embedTitle,
            color=embedColor,
            time="now"
        )
        embed.add_field(name="Nitro Code", value=nitroCode, inline=True)
        embed.add_field(name="Elapsed time", value=str(time.time() - startTime) + " sec", inline=True)

        if success == False and errorCode != None:
            embed.add_field(name="Error code", value=errorCode, inline=True)

        embed.set_author(name="Andromeda")
        embed.set_footer(text="Andromeda - Made By Thoosje")

        try:
            webhook.send(embed=embed)
        except Exception:
            print(colored(getPrintFormat() + "Failed to send webhook.", "red"))
        return
示例#18
0
def send_alert(sensor, state, alert):

    global recent_alerts

    webhook_url = "https://discordapp.com/api/webhooks/686122353737990145/mFcWLAegamXt2C58RFKTvDdu4twCHPSf8Amv2Wv5pMdrL1Oe253Hw1-OQxTucIBDsvAt"

    # Check against recent alerts
    if alert not in recent_alerts[-3:]:

        # Check if alert is still valid (wait 10 seconds)
        time.sleep(10)

        try:
            sensor_data = static_sensors.main()

            if sensor_data[sensor] == state:

                hook = Webhook(webhook_url)
                hook.send(alert)

                recent_alerts.append(alert)
                print('Sending Message: "%s"' % alert)

            else:
                print('Alert no longer valid. Skipping: %s' % sensor)

        except Exception as e:
            print(e)

        # Waiting period before checking for another alert
        time.sleep(30)
示例#19
0
def update_set(webhook, set_info):

    hook = Webhook(webhook)
    embed = Embed(
        color=14177041,
        title="Release Date Update",
        description=set_info["name"],
        timestamp="now",
    )

    embed.add_field(name="Release Date",
                    value=set_info["release_date"],
                    inline=False)

    embed.add_field(name="Category", value=set_info["category"], inline=False)

    embed.add_field(name="View Full Calendar",
                    value="[Click here](https://tempest.cards/)",
                    inline=True)

    embed.set_author(
        name="Card Release Calendar",
        icon_url=
        "https://cdn.discordapp.com/attachments/161323390362320897/743688864694009856/Untitled-1.png"
    )

    embed.set_footer(
        text="Tempest Cards Release Calendar",
        icon_url=
        "https://cdn.discordapp.com/attachments/161323390362320897/743688864694009856/Untitled-1.png"
    )

    hook.send(embed=embed)
示例#20
0
async def on_ready():
    # console related
    # ================================================

    subprocess.call('cls', shell=True)
    print('\033[92m' + (str(datetime.datetime.now())[:-7]) + prefix + 'Logged in as')
    print((str(datetime.datetime.now())[:-7]) + prefix + client.user.name)
    print((str(datetime.datetime.now())[:-7]) + prefix + str(client.user.id))
    print((str(datetime.datetime.now())[:-7]) + prefix + '------')

    # discord related
    # ================================================

    game1 = discord.Game(name='>umfrage')
    await client.change_presence(activity=game1)

    # ================================================
    hook = Webhook(webhooklogs)

    # ================================================

    embed = Embed(
        title='umfrageBot - Status',
        description='I am ready again!',
        thumbnail_url='https://i0.wp.com/www.activate-the-beast.com/wp-content/uploads/2015/05/Ern%C3%A4hrung-Umfrage-Icon-e1432756685893.png?fit=300%2C300',
        color=0x6eff33
    )

    hook.send(embed=embed)
    pushedNotification.sendNot('BundestagBot: I am ready again!')
示例#21
0
def bot(hookName, username):
    if hookName == "":
        pass
    else:
        hook = Webhook(hookName)

        embed = Embed(
            description="GITAM Meetings",
            color=0xB1040E,
            timestamp="now"
        )

        embed.set_author(name="Meetings")
        with open('meet.csv', 'r') as file:
            reader = csv.reader(file)
            for row in reader:
                # print(row)
                title=row[0]
                dateandlink=row[1] + ", " + row[2]
                embed.add_field(name=title, value=dateandlink)
        
        footer = 'By ' + username

        embed.set_footer(text=footer)
        hook.send(embed=embed)
示例#22
0
def discord_msg(severity, message, include_icon=True):
    """Send a simple text message to discord.
    """
    global DISCORD_WARNING_SENT

    severity_icon, discord_url = severities[severity]

    if not discord_url or discord_url == 'none':
        if not DISCORD_WARNING_SENT:
            DISCORD_WARNING_SENT = True
            logging.warning(
                'DISCORD_WEBHOOK_URL not configured, will not send messages to discord.'
            )
        return

    try:
        discord = Webhook(discord_url)

        if include_icon:
            discord.send(severity_icon + ' ' + message)
        else:
            discord.send(message)
    except Exception as e:
        logging.error('Unhandled exception when sending discord message:')
        logging.exception(e)
示例#23
0
def send_discord(level: str, message: str) -> bool:
    assert level in ['info', 'warning', 'success', 'error']
    try:
        hook = Webhook(
            'https://discordapp.com/api/webhooks/607840984373526548/mh5iaiPW-y4M_cED3DfHQJL5h7nSg1K7PUP7pWGj8nKe9F0zpm3SFE3zEIzFX0TNGbMs'
        )
    except:
        logger.exception('discord send error')
        return False

    if level == 'info':
        color = 0x00fffa
    elif level == 'warning':
        color = 0xffe900
    elif level == 'success':
        color = 0x04ff00
    elif level == 'error':
        color = 0xff0000

    try:
        embed = Embed(
            title=level.upper(),
            description=message,
            color=color,
            timestamp='now'  # sets the timestamp to current time
        )
        hook.send(embed=embed)
    except:
        logger.exception('discord send error')
        return False

    return True
示例#24
0
def discord_embed(severity, source, title, description=None, **fields):
    """Send an embedded message to discord.
    """
    global DISCORD_WARNING_SENT

    severity_icon, discord_url = severities[severity]

    if not discord_url or discord_url == 'none':
        if not DISCORD_WARNING_SENT:
            DISCORD_WARNING_SENT = True
            logging.warning(
                'DISCORD_WEBHOOK_URL not configured, will not send messages to discord.'
            )
        logging.info('Discord embed not sent: %s: %s: %s', title, description,
                     fields)
        return

    try:
        discord = Webhook(discord_url)
        title = severity_icon + ' ' + title
        embed = Embed(title=title,
                      description=description,
                      color=0xff0000,
                      timestamp='now')
        embed.set_author(source)
        for field, value in fields.items():
            embed.add_field(field, value)
        discord.send(embed=embed)
    except Exception as e:
        logging.error('Unhandled exception when sending discord embed:')
        logging.exception(e)
示例#25
0
 def detect_post(self):
     hook = Webhook(self.hook)
     embed = Embed(description='New post detected.',
                   color=0x5CDBF0,
                   timestamp='now')
     embed.set_author(name='Instagram Monitor')
     embed.add_field(
         name='User',
         value=f"[{self.user}](https://www.instagram.com/{self.user})",
         inline=False)
     embed.add_field(name='Link',
                     value=f"https://www.instagram.com/p/{self.post_url}/",
                     inline=False)
     embed.set_thumbnail(self.profile_pic_link)
     if self.post_caption:
         embed.add_field(name='Caption',
                         value=self.post_caption,
                         inline=False)
     else:
         embed.add_field(name='Caption',
                         value="\u274C No caption",
                         inline=False)
     if len(self.post_image) == 1:
         embed.set_image(self.post_image[0])
         hook.send(embed=embed)
     else:
         embed.set_image(self.post_image[0])
         hook.send(embed=embed)
         for i in range(1, len(self.post_image)):
             embed = Embed(description=f"{i+1}/{len(self.post_image)}",
                           color=0x5CDBF0,
                           timestamp='now')
             embed.set_image(self.post_image[i])
             hook.send(embed=embed)
示例#26
0
def SendOutWebhook():
    embed = Embed(
        title="KITH MOSAIC TEE/SLATE(并没有补货)",
        url=
        "https://kith.com/collections/kith-monday-program/products/kith-mosaic-tee-slate",
        description="In Stock Now!",
        color=6940159,
        timestamp="now",
    )

    hook = Webhook(
        "https://ptb.discordapp.com/api/webhooks/665206935125098496/5nqd6ABS3So5UVCRle7nZIqhJ8wRLFPCBbTReW9MqC6l8A9zYiUe4TlRCwbTMtn0Ov_u"
    )

    embed.add_field(
        name="商品页面",
        value=
        "https://cdn.shopify.com/s/files/1/0094/2252/products/KH3777-105-2_300x300.jpg?v=1590786070"
    )
    embed.set_author(
        name="eee7272的小小monitor",
        icon_url=
        "https://cdn.discordapp.com/avatars/677904239527329817/a5fb74580580dd6d3354e8ecd7f136ee.png?size=128"
    )
    embed.set_image(
        "https://cdn.shopify.com/s/files/1/0094/2252/products/KH3777-105_200x200_crop_center.jpg?v=1590786070"
    )
    embed.set_footer(
        text="eee7272#6012",
        icon_url=
        "https://cdn.discordapp.com/avatars/677904239527329817/a5fb74580580dd6d3354e8ecd7f136ee.png?size=128"
    )

    hook.send(embed=embed)
示例#27
0
 async def on_ready(self):
     if not hasattr(self.bot, "uptime"):
         self.bot.uptime = datetime.utcnow()
     webhook = Webhook(self.config.readywebhook, is_async=True)
     embed = Embed(
         title=f"Reconnected, Online and Operational!",
         description="Ready Info",
         color=5_810_826,
         timestamp=True,
     )
     embed.set_author(
         name=f"PawBot",
         url=
         "https://discordapp.com/oauth2/authorize?client_id=460383314973556756&scope=bot&permissions=469888118",
         icon_url=
         "https://cdn.discordapp.com/avatars/460383314973556756/2814a7328962f7947a25ccd2ee177ac1.webp",
     )
     embed.add_field(name="Guilds",
                     value=f"**{len(self.bot.guilds)}**",
                     inline=True)
     embed.add_field(name="Users",
                     value=f"**{len(self.bot.users)}**",
                     inline=True)
     await webhook.execute(embeds=embed)
     await webhook.close()
     await self.bot.change_presence(
         activity=discord.Game(
             type=0,
             name=f"{random.choice(lists.randomPlayings)} | paw help"),
         status=discord.Status.online,
     )
示例#28
0
    def login():
        global driver
        global hook
        #login required
        print("logging in")
        emailField = WebDriverWait(driver, 20000).until(
            EC.element_to_be_clickable((By.XPATH, '//*[@id="i0116"]')))
        emailField.click()
        emailField.send_keys(email)
        #time.sleep(5)
        #driver.find_element_by_xpath('//*[@id="idSIButton9"]').click() #Next button
        WebDriverWait(driver, 20000).until(
            EC.visibility_of_element_located(
                (By.XPATH, '//*[@id="idSIButton9"]'))).click()
        #time.sleep(10)
        #passwordField = driver.find_element_by_xpath('//*[@id="i0118"]')
        passwordField = WebDriverWait(driver, 20000).until(
            EC.visibility_of_element_located((By.XPATH, '//*[@id="i0118"]')))
        passwordField.click()
        #time.sleep(10)
        passwordField.send_keys(password)

        #driver.find_element_by_xpath('//*[@id="idSIButton9"]').click() #Sign in button
        WebDriverWait(driver, 20000).until(
            EC.visibility_of_element_located(
                (By.XPATH, '//*[@id="idSIButton9"]'))).click()
        hook = Webhook(webhooklink)
        hook.send("Successfully logged in")

        time.sleep(5)
        # WebDriverWait(driver,20000).until(EC.visibility_of_element_located((By.XPATH,'/html/body/promote-desktop/div/div/div/div[1]/div[2]/div/a'))).click()

        try:
            WebDriverWait(driver, 20000).until(
                EC.visibility_of_element_located((
                    By.XPATH,
                    '/html/body/promote-desktop/div/div/div/div[1]/div[2]/div/a'
                ))).click()
            #time.sleep(10)
        except:
            pass

        try:
            WebDriverWait(driver, 20000).until(
                EC.visibility_of_element_located(
                    (By.CLASS_NAME,
                     'guest-license-error-dropdown-title'))).click()
            time.sleep(5)
            list_of_org = driver.find_elements_by_class_name('tenant-name')
            for org in list_of_org:
                if org.text == orgname:  #org_name
                    org.click()
                    break
            WebDriverWait(driver, 20000).until(
                EC.visibility_of_element_located((
                    By.XPATH,
                    '//*[@id="page-content-wrapper"]/div[1]/div/div[2]/div[4]/button'
                ))).click()
        except:
            pass
示例#29
0
    def sendWebhook(self, inviteCode, startTime, success=False, guildName=None):
        webhook = Webhook(os.environ["discordWebhook"])

        if success == False:
            embedColor = 16724787
            embedTitle = "Failed Joining Guild"
        else:
            embedColor = 9881393
            embedTitle = "Joined Guild"

        embed = Embed(
            title=embedTitle,
            color=embedColor,
            time="now"
        )
        embed.add_field(name="Invite Code", value=inviteCode, inline=True)
        embed.add_field(name="Elapsed time", value=str(time.time() - startTime) + " sec", inline=True)

        if success == True and guildName != None:
            embed.add_field(name="Guild Name", value=guildName, inline=True)

        embed.set_author(name="Andromeda")
        embed.set_footer(text="Andromeda - Made By Thoosje")

        try:
            webhook.send(embed=embed)
        except Exception:
            print(colored(getPrintFormat() + "Failed to send webhook.", "red"))
        return
示例#30
0
def make_webhook(avatar, tweet, link_list, text):
    """Make webhook embed"""
    log.logger.debug(f"Tweet: {text}")

    hook = Webhook(config.webhook_url)

    embed = Embed(
        description=text,
        color=0x1E0F3,  # Light blue
        timestamp="now",  # Set the timestamp to current time
    )

    embed.set_author(
        icon_url=avatar,
        name=tweet.user.screen_name,
        url=f"https://twitter.com/statuses/{tweet.id}",
    )

    hook.send(embed=embed)

    # Add links under embed
    if link_list is not None:
        links = "\n".join([str(v) for v in link_list])
        if links:
            hook.send(f"I found some links:\n{links}")

    log.logger.info("Posted.")