Example #1
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")
Example #2
0
def post_message(product_link, product_image, product_name, product_price,
                 instock_list):
    hook = Webhook(hook_url)
    embed = Embed(description='', color=0x5CDBF0, timestamp='now')
    embed.set_title(title=product_name, url=product_link)
    embed.add_field(name='Price', value=product_price)
    embed.add_field(name='Stock', value='\n'.join(instock_list))
    embed.set_thumbnail(url=product_image)
    embed.set_footer(
        text='Ssense Monitor by zyx',
        icon_url=
        'https://pbs.twimg.com/profile_images/1118878674642714624/lNXTIWNT_400x400.jpg'
    )
    hook.send(embed=embed)
Example #3
0
 def detect_bio(self):
     hook = Webhook(self.hook)
     embed = Embed(description='New bio detected.',
                   color=0x5CDBF0,
                   timestamp='now')
     embed.set_title('Instagram Monitor')
     embed.add_field(
         name='User',
         value=f"[{self.user}](https://www.instagram.com/{self.user})",
         inline=False)
     if self.bio:
         embed.add_field(name='Bio', value=self.bio, inline=False)
     else:
         embed.add_field(name='Bio', value="\u274C Empty Bio", inline=False)
     embed.set_thumbnail(self.profile_pic_link)
     hook.send(embed=embed)
Example #4
0
def post_discord(purl, title, price, image, available_sizes):
    hook = Webhook(webhook_url)
    embed = Embed(description='', color=0x5CDBF0, timestamp='now')
    embed.set_author(name='Custom Shopify Monitor', icon_url='')
    embed.set_title(title=title, url=purl)
    embed.set_footer(
        text='@zyx898',
        icon_url=
        'https://pbs.twimg.com/profile_images/1201960848073383937/XzQhFIiM_400x400.jpg'
    )
    embed.add_field(name='Link', value=purl, inline=True)
    embed.add_field(name='Stock',
                    value=" | ".join(available_sizes),
                    inline=False)
    embed.set_thumbnail(image)
    hook.send(embed=embed)
Example #5
0
def SendHook(name, price, productUrl, image, proid, status):
    client = Webhook(
        "https://discordapp.com/api/webhooks/565627801072435232/-PqcddPV0FG3mGucvU__zpTSPlcdC12MQ9kq_3X0QJW5DwwFKT6htY9-qtq_QEtYwz0t"
    )
    global embed1
    embed1 = Embed()
    #embed1.color = None
    embed1.set_title(title=name, url=productUrl)
    embed1.set_thumbnail(image)
    embed1.add_field(name="Status", value=str(status), inline=True)
    embed1.add_field(name="Product URL", value=productUrl, inline=False)
    embed1.add_field(name="PID", value=proid, inline=True)
    embed1.add_field(name="Price", value=price)
    embed1.set_footer(
        text=f"jdrez • {str(datetime.datetime.now())}",
        icon_url=
        "https://cdn.discordapp.com/attachments/553047247466790924/565627921344102431/porter.jpg"
    )
    client.send(embeds=[embed1])
Example #6
0
def SendHook(name, price, productUrl, image, proid, status):
    client = Webhook(
        "https://discordapp.com/api/webhooks/565625299753107471/0pe8umQLMBUXs96J8y2u7SwhkKD2r4HLunl1LCWQ06e1K8wisS2BDoFm18I9RYsl-YfR"
    )
    global embed1
    embed1 = Embed()
    #embed1.color = None
    embed1.set_title(title=name, url=productUrl)
    embed1.set_thumbnail(image)
    embed1.add_field(name="Status", value=str(status), inline=True)
    embed1.add_field(name="Product URL", value=productUrl, inline=False)
    embed1.add_field(name="PID", value=proid, inline=True)
    embed1.add_field(name="Price", value=price)
    embed1.set_footer(
        text=f"jdrez • {str(datetime.datetime.now())}",
        icon_url=
        "https://cdn.discordapp.com/attachments/553047247466790924/565625485799850141/favicon-192x192.png"
    )
    client.send(embeds=[embed1])
Example #7
0
def generate_embed(url):
    """
    URLのページを確認してEmbedに整形する
    """
    article_html = html.unescape(get_html(url))

    # 記事の本文
    body = re.search(
        "<!-- begin text -->\r\n(.+?)<!-- end text -->",
        re.sub("<[^<>!]*>", "__", article_html),
        flags=(re.MULTILINE | re.DOTALL),
    ).group(1)
    # 文字数制限の回避(本文以外の制限は超えることがないので省略)
    # https://discordjs.guide/popular-topics/embeds.html#embed-limits
    if len(body) > 2048:
        body = body[:2014] + "…\n:warning:文字数が2048文字を超えたため省略されました"
    embed = Embed(description=body, color=0x7E6CA8)

    # 記事の詳細
    field = dict(re.findall("(.+?): (.+?)<BR>", article_html))
    if title := field.get("Subject"):
        embed.set_title(title=f":newspaper: {title}", url=url)
Example #8
0
        count += 1
        print("Done")

                
        if count == 6:
    
            break
        

for submission in subreddit.stream.submissions(skip_existing=True):
	imagerequests = requests.get(f"https://reddit.com/{str(submission.permalink)}.json", headers=headers).json()
	imageurl = imagerequests[0]["data"]["children"][0]["data"]["url"]
	print(imageurl)
	if "jpg" not in imageurl:
		embed = Embed(color=0x008080, timestamp='now')
		embed.set_title(title=str(submission.title), url=f"https://reddit.com{str(submission.permalink)}")
		embed.set_author(name="Minimal_Setups", url="https://www.reddit.com/r/Minimal_Setups/",icon_url="https://styles.redditmedia.com/t5_rtmbn/styles/communityIcon_7qjzvrk4fjp41.png")
		embed.add_field(name="Author",value=str(submission.author), inline=False)
		hook1.send(embed=embed)
	else:
		print("Image Found")
		embed = Embed(color=0x008080, timestamp='now')
		embed.set_title(title=str(submission.title), url=f"https://reddit.com{str(submission.permalink)}")
		embed.set_author(name="Minimal_Setups", url="https://www.reddit.com/r/Minimal_Setups/",icon_url="https://styles.redditmedia.com/t5_rtmbn/styles/communityIcon_7qjzvrk4fjp41.png")
		embed.add_field(name="Author",value=str(submission.author), inline=False)
		embed.set_image(imageurl)
		hook1.send(embed=embed)
    


Example #9
0
def send_message(card_detail_id, market_id, second_min, edition, is_gold,
                 card_uid, seller, bcx, level, card_price, percent):
    if second_min > 0.05:
        r = requests.get("https://steemmonsters.com/cards/get_details").json()
        for i in r:
            if i['id'] == int(card_detail_id):
                name = i['name']
                break
        if edition == 0:
            edition_txt = "Alpha"
        elif edition == 1:
            edition_txt = "Beta"
        elif edition == 2:
            edition_txt = "Promo"
        elif edition == 3:
            edition_txt = "Reward"
        else:
            edition_txt = "Untamed"
        price_info_json = requests.get(
            "https://steemmonsters.com/settings").json()
        sbd_price = price_info_json['sbd_price'] - 0.02
        steem_price = price_info_json['steem_price'] - 0.01
        dec_price = price_info_json['dec_price']
        dec_send = round(card_price / dec_price, 3)
        sbd_send = round(card_price / sbd_price, 3)
        stmc_sbd = str(sbd_send) + " SBD"
        steem_send = round(card_price / steem_price, 3)
        stmc_steem = str(steem_send) + " STEEM"
        dec = """["custom_json",{"required_auths":["__signer"],"required_posting_auths":[],"id":"sm_market_purchase","json":"{\\"items\\":[\\"@\\"],\\"purchaser\\":\\"__signer\\",\\"market\\":\\"svirus\\"}"}]"""
        dec = dec.split("@")
        dec = dec[0] + market_id + dec[1]
        encoded_dec = base64.b64encode(bytes(dec, "utf-8"))
        string = encoded_dec.decode("utf-8")
        final_dec = f"https://beta.steemconnect.com/sign/op/{string.replace('=', '.')}?authority=active"
        memo = "sm_market_purchase:{}".format(market_id)
        stmconnect = SteemConnect()
        steem_link = stmconnect.create_hot_sign_url("transfer", {
            "to": "svirus",
            "amount": stmc_steem,
            "memo": memo
        })
        sbd_link = stmconnect.create_hot_sign_url("transfer", {
            "to": "svirus",
            "amount": stmc_sbd,
            "memo": memo
        })
        thumbnail_link = thumbnail_generator(edition, name, is_gold)
        embed = Embed(color=15105817, timestamp='now')
        if bcx == 1:
            embed.set_thumbnail(thumbnail_link)
            embed.set_author(f"{name}\n{card_uid} by @{seller}")
            embed.set_title(
                f"Edition: {edition_txt}, Gold: {is_gold}, Bcx: {bcx}, Level: {level}\nPrice: {card_price}$, Cheaper: {percent}%, Second Lowest: {second_min}"
            )
            embed.add_field(
                name=".",
                value=
                f"Commands:\n**STEEM**: `..transfer {steem_send} steem svirus {memo}`\n**SBD**: `..transfer {sbd_send} sbd svirus {memo}`\n\nSteemconnect:\n[{steem_send} STEEM]({steem_link})\n[{sbd_send} SBD]({sbd_link})\n[{dec_send} DEC]({final_dec})\n\n**Verify**: `..verify {market_id}`"
            )
        else:
            one_card_price = round(card_price / bcx, 3)
            embed.set_thumbnail(thumbnail_link)
            embed.set_author(f"{name}\n{card_uid} by @{seller}")
            embed.set_title(
                f"Edition: {edition_txt}, Gold: {is_gold}, Bcx: {bcx}, Level: {level}\nPrice: {card_price}$, Per bcx: {one_card_price}$, Cheaper: {percent}%, Second Lowest: {second_min}"
            )
            embed.add_field(
                name=".",
                value=
                f"Commands:\n**STEEM**: `..transfer {steem_send} steem svirus {memo}`\n**SBD**: `..transfer {sbd_send} sbd svirus {memo}`\n\nSteemconnect:\n[{steem_send} STEEM]({steem_link})\n[{sbd_send} SBD]({sbd_link})\n[{dec_send} DEC]({final_dec})\n\n**Verify**: `..verify {market_id}`"
            )
        try:
            if percent > 40:
                fhook.send(embed=embed)
                fhook.close()
            elif bcx > 1:
                mhook.send(embed=embed)
                mhook.close()
            elif is_gold is True:
                ghook.send(embed=embed)
                ghook.close()
            elif edition == 0:
                ahook.send(embed=embed)
                ahook.close()
            elif edition == 4:
                uhook.send(embed=embed)
                uhook.close()
            else:
                bhook.send(embed=embed)
                bhook.close()
        except:
            print(traceback.format_exc())
Example #10
0
em1.color = 0x00FF00  # colors should be a hexadecimal value
em1.description = """This description supports
[named links](https://discord.com) as well.

``` \n
yes, even code blocks```
"""

em1.timestamp = "2018-04-30T05:34:26-07:00"

em1.set_author(name='Author Goes Here',
               icon_url='https://i.imgur.com/rdm3W9t.png',
               url='https://discord.com/')

em1.set_title(title='title ~~(did you know you can have markdown here too?)~~',
              url='https://discord.com/')

em1.add_field(name="Field 1 :smiley:",
              value="some of these properties have certain limits...",
              inline=False)

em1.add_field(name="Field 2 😱",
              value="try exceeding some of them!",
              inline=False)

em1.add_field(name="Field 3 🙄", value="Jokes, dont do that.", inline=False)

em1.add_field("Field 4 🙄", "these last two")
em1.add_field("Field 5 🙄", "are inline fields")

em1.add_field('hello', 'bob')
Example #11
0
    time.sleep(random.uniform(.05, .2))
    print("Submitting Billing...")
    time.sleep(random.uniform(.05, .2))
    print("Submitting Billing...")
    time.sleep(random.uniform(.05, .2))
    print("Submitting Payment...")
    time.sleep(random.uniform(.05, .2))
    print("Submitting Payment...")
    time.sleep(random.uniform(.05, .2))
    print("Submitting Payment...")
    time.sleep(random.uniform(.05, .2))
    print("Submitting Payment...")
    time.sleep(random.uniform(.05, .2))
    print("Processing Order...")
    time.sleep(random.uniform(.05, .2))
    print("Processing Order...")
    time.sleep(random.uniform(.05, .2))
    print("Checked Out!!!")
    print("Product Checked Out:" + site + " " + shoe + " For $" + itemPrice)
    endtimer = time.time()
    checkedOut = Embed(color=0x0000FF)
    checkedOut.set_title("­Ъца Fortnite Bot Success! ­Ъца")
    checkedOut.add_field(name="**Store:** ", value=site)
    checkedOut.add_field(name="**Item:** ", value=shoe)
    checkedOut.add_field(name="**Price:** ", value="$" + itemPrice)
    checkedOut.add_field(name="**Check Out Speed:** ",
                         value=str(round(endtimer - initialTimer, 2)) + "s")
    checkedOut.set_footer(text="Fortnite Bot ---" +
                          str(datetime.datetime.now()))
    hook.send(embed=checkedOut)
Example #12
0
    # if the post links to spectrum
    if 'https://robertsspaceindustries.com/spectrum/' in submission.url:

        if posts.document(u'' + postCreated + '').get().exists == False:
            doc_ref = posts.document(u'' + postCreated + '')
            doc_ref.set({
                u'id': u'' + postId + '',
                u'created': u'' + postCreated + '',
                u'title': u'' + postTitle + ''
            })
            # Send message to Discord server
            embed = Embed(
                color=14177041,
                timestamp='now',
            )
            embed.set_title(title=':smiley:  -> Un nouveau patch est dispo!',
                            url='' + submission.url + '')
            embed.add_field(name='Info Patch', value='' + postTitle + '')
            embed.set_footer(text='Script by Luicid', icon_url=imgIcon)
            embed.set_image(imgBig)

            if testMode == False:
                hook.send(embed=embed)
                hook_septra.send(embed=embed)
                hook.send("@everyone")
            else:
                print('Test Mode enabled - don\'t send discord msg')

        else:
            print('The document: ' + postCreated + ' for the post ' + postId +
                  ' exist in the database')
    else:
Example #13
0
async def on_command_error(ctx, error):
    error_text = str(error)

    err_msg = f"Error with \"{ctx.message.content}\" from "\
              f"\"{ctx.message.author} ({ctx.message.author.id}) "\
              f"of type {type(error)}: {error_text}"
    log.error(err_msg)

    if not isinstance(error, commands.CommandNotFound):
        err2 = f"Error with \"{ctx.message.content}\" from "\
               f"\"{ctx.message.author} ({ctx.message.author.id}) "\
               f"of type {type(error)}: {error_text}"
        hook = Webhook(config.webhookurl)  # Log Errors
        embed = Embed(description=f"{err2}", color=0xff0000, timestamp='now')
        embed.set_title(title="ERROR")
        hook.send(embed=embed)

    if isinstance(error, commands.NoPrivateMessage):
        return await ctx.send("This command doesn't work in DMs.")
    elif isinstance(error, commands.MissingPermissions):
        roles_needed = '\n- '.join(error.missing_perms)
        return await ctx.send(f"{ctx.author.mention}: You don't have the right"
                              " permissions to run this command. You need: "
                              f"```- {roles_needed}```")
    elif isinstance(error, commands.BotMissingPermissions):
        roles_needed = '\n-'.join(error.missing_perms)
        return await ctx.send(f"{ctx.author.mention}: Bot doesn't have "
                              "the right permissions to run this command. "
                              "Please add the following permissions: "
                              f"```- {roles_needed}```")
    elif isinstance(error, commands.CommandOnCooldown):
        return await ctx.send(f"{ctx.author.mention}: ⚠ You're being "
                              "ratelimited. Try again in "
                              f"{error.retry_after:.1f} seconds.")
    elif isinstance(error, commands.NotOwner):
        return await ctx.send(
            f"{ctx.author.mention}: ❌ You cannot use this command "
            "as it's only for the owner of the bot!")
    elif isinstance(error, commands.CheckFailure):
        return await ctx.send(f"{ctx.author.mention}: Check failed. "
                              "You might not have the right permissions "
                              "to run this command.")
    elif isinstance(error, discord.NotFound):
        return await ctx.send("❌ I wasn't able to find that ID.")

    help_text = f"Usage of this command is: ```{ctx.prefix}"\
                f"{ctx.invoked_with} {ctx.command.signature}```\nPlease see `{ctx.prefix}help "\
                f"{ctx.command.name}` for more info about this command."
    if isinstance(error, commands.BadArgument):
        return await ctx.send(f"{ctx.author.mention}: You gave incorrect "
                              f"arguments. {help_text}")
    elif isinstance(error, commands.MissingRequiredArgument):
        return await ctx.send(f"{ctx.author.mention}: You gave incomplete "
                              f"arguments. {help_text}")
    elif isinstance(error, commands.CommandInvokeError) and\
            ("Cannot send messages to this user" in error_text):
        return await ctx.send(f"{ctx.author.mention}: I can't DM you.\n"
                              "You might have me blocked or have DMs "
                              f"blocked globally or for {ctx.guild.name}.\n"
                              "Please resolve that, then "
                              "run the command again.")
    elif isinstance(error, commands.CommandNotFound):
        return
Example #14
0
    def send(self):
        global field_status
        try:
            url = self.ui.url.text()
            name = self.ui.name.text()
            avatar = self.ui.avatar.text()
            author = self.ui.embed_author.text()
            author_avatar = self.ui.embed_author_avatar.text()
            author_url = self.ui.embed_author_url.text()
            description = self.ui.embed_description.text()
            footer = self.ui.embed_footer.text()
            footer_icon = self.ui.embed_footer_icon.text()
            title = self.ui.embed_title.text()
            thumbnail = self.ui.embed_thumbnail.text()
            image = self.ui.embed_image.text()
            title_url = self.ui.embed_title_url.text()
            print(self.color)
            if self.color:
                color = self.converthex2discord(self.color)
            else:
                color = 0x00FF00
            print(color, type(color))
            feeds_list, field_status = self.get_fields()

            timestamp_check = self.ui.timestamp.isChecked()
            if len(url) > 0:
                hook = Webhook(url,
                               is_async=False,
                               session=None,
                               username=name,
                               avatar_url=avatar)
                if timestamp_check:
                    if description:
                        print("timestamp - description")
                        embed = Embed(description=description,
                                      color=color,
                                      timestamp='now')
                    else:
                        print("timestamp not description")
                        embed = Embed(color=color, timestamp='now')
                else:
                    if description:
                        print("not timestamp description")
                        embed = Embed(description=description, color=color)
                    else:
                        print("not timestamp not description")
                        embed = Embed(color=color)

                if author and author_avatar and author_url:
                    print("author and author_avatar and author_url")

                    embed.set_author(name=author,
                                     icon_url=author_avatar,
                                     url=author_url)
                elif author and not author_avatar and not author_url:
                    print("author and not author_avatar and not author_url")
                    embed.set_author(name=author)
                elif author and author_avatar and not author_url:
                    print("author and author_avatar and not author_url")
                    embed.set_author(name=author, icon_url=author_avatar)
                elif author and not author_avatar and author_url:
                    print("author and not author_avatar and author_url")
                    embed.set_author(name=author, url=author_url)

                if title and url:
                    print("title, url")
                    embed.set_title(title=title, url=title_url)
                if title and not url:
                    print("title and not url")
                    embed.set_title(title=title)
                if field_status:
                    print(feeds_list)
                    for field in feeds_list:
                        print("field in field_table")
                        embed.add_field(name=field["name"],
                                        value=field["value"],
                                        inline=False)
                if thumbnail:
                    print("thumbnail")
                    embed.set_thumbnail(thumbnail)
                if image:
                    print("image")
                    embed.set_image(image)
                if footer and footer_icon:
                    print("footer and footer_icon")
                    embed.set_footer(text=footer, icon_url=footer_icon)
                if footer and not footer_icon:
                    print("footer and not footer_icon")
                    embed.set_footer(text=footer)
                hook.send(embed=embed)
        except Exception:
            url = self.ui.url.text()
            name = self.ui.name.text()
            avatar = self.ui.avatar.text()
            author = self.ui.embed_author.text()
            author_avatar = self.ui.embed_author_avatar.text()
            author_url = self.ui.embed_author_url.text()
            description = self.ui.embed_description.text()
            footer = self.ui.embed_footer.text()
            footer_icon = self.ui.embed_footer_icon.text()
            title = self.ui.embed_title.text()
            thumbnail = self.ui.embed_thumbnail.text()
            image = self.ui.embed_image.text()
            title_url = self.ui.embed_title_url.text()
            feeds_list, field_status = self.get_fields()
            if self.color:
                color = self.converthex2discord(self.color)
            else:
                color = 0x00FF00
            data = {
                "url": url,
                "name": name,
                "avatar": avatar,
                "author": author,
                "author_avatar": author_avatar,
                "author_url": author_url,
                "description": description,
                "footer": footer,
                "footer_icon": footer_icon,
                "title": title,
                "thumbnail": thumbnail,
                "image": image,
                "title_url": title_url,
                "color": color,
                "self.color": self.color,
                "fields": json.dumps(feeds_list)
            }
            self.error_handler.set_error(traceback.format_exc(), data=data)
            self.error_handler.show()