コード例 #1
0
def send_embed(alert_type, link, fields, site, image, product):
    '''
    (str, str, list, str, str, str) -> None
    Sends a discord alert based on info provided.
    '''

    url = webhook

    embed = Webhook(url, color=123123)

    if (alert_type == "NEW_SHOPIFY"):
        desc = "NEW: " + product
    elif (alert_type == "RESTOCK_SHOPIFY"):
        desc = "RESTOCK: " + product

    embed.set_author(
        name='NERYS',
        icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg')
    embed.set_desc(desc)

    for field in fields:
        if (alert_type == "NEW_SHOPIFY" or alert_type == "RESTOCK_SHOPIFY"):
            cart_link = site + "/cart/" + str(field[1]) + ":1"
            embed.add_field(name=str(field[0]), value=cart_link)

    if (image is not None):
        embed.set_thumbnail(image)
        embed.set_image(image)

    embed.set_footer(
        text='NERYS by @snivynGOD',
        icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg',
        ts=True)

    embed.post()
コード例 #2
0
def send_embed(link, fields, site, image, product, webhook):
    '''
    (str, str, list, str, str, str) -> None
    Sends a discord alert based on info provided.
    '''

    embed = Webhook(webhook, color=123123)

    #if(alert_type == "NEW_SHOPIFY"):
    desc = product
    #elif(alert_type == "RESTOCK_SHOPIFY"):
    #desc = "RESTOCK: " + product

    embed.set_author(name='coplitshoes', icon='')
    embed.set_desc(desc)

    for field in fields:
        #if(alert_type == "NEW_SHOPIFY" or alert_type == "RESTOCK_SHOPIFY"):
        cart_link = site + "/cart/" + str(field[1]) + ":1"
        embed.add_field(name=str(field[0]), value=cart_link)

    if (image is not None):
        embed.set_thumbnail(image)
        embed.set_image(image)

    embed.set_footer(text='coplitshoes', icon='', ts=True)

    embed.post()
コード例 #3
0
ファイル: shopify-sites.py プロジェクト: ihof/shopify
def send_embed(alert_type, link, fields, site, image, product):
    '''
    (str, str, list, str, str, str) -> None
    Sends a discord alert based on info provided.
    '''

    url = webhook

    embed = Webhook(url, color=123123)

    if(alert_type == "NEW_SHOPIFY"):
        desc = "NEW: " + product
    elif(alert_type == "RESTOCK_SHOPIFY"):
        desc = "RESTOCK: " + product

    embed.set_author(name='StirFry', icon='https://pbs.twimg.com/profile_images/1086659064304676865/oX8NsFC-_400x400.jpg')
    embed.set_desc(desc)

    for field in fields:
        if(alert_type == "NEW_SHOPIFY" or alert_type == "RESTOCK_SHOPIFY"):
            cart_link = site + "/cart/" + str(field[1]) + ":1"
            embed.add_field(name=str(field[0]), value=cart_link)

    if(image is not None):
        embed.set_thumbnail(image)
        embed.set_image(image)

    embed.set_footer(text='StirFry', icon='https://pbs.twimg.com/profile_images/1086659064304676865/oX8NsFC-_400x400.jpg', ts=True)

    embed.post()
コード例 #4
0
def error_hooking(base, type):
    url = "<WEBHOOK>"
    embed = Webhook(url, color=123123)
    embed.set_desc(type.strip(':'))
    embed.add_field(name="Link", value=base)
    embed.add_field(name="Error", value="Can't get this product. Please contact with developer")
    embed.set_footer(text='Powered by <COMPANY NAME>', ts=True,icon='<ICON>')
    embed.post()
コード例 #5
0
 def post_to_webhook(self, slug):
     post = self.get_post_from_server(slug)
     msg_string = (post['body'][:250] + '...') if len(post['body']) > 250 else post['body']
     embed = Webhook(HOOK_URL, color=123123)
     embed.set_author(name=post['title'], icon='https://cdn6.aptoide.com/imgs/5/1/f/51fc6f8666c50ce7456651810d7a4439_icon.png?w=240')
     embed.set_desc(msg_string)
     embed.add_field(name='Read more', value=post['url'])
     embed.post()
コード例 #6
0
def send_embed(alert_type, product):
    '''
    (str, str, list, str, str, str) -> None
    Sends a discord alert based on info provided.
    '''
    # Set webhook
    url = discord_webhook

    # Create embed to send to webhook
    embed = Webhook(url, color=123123)

    # Set author info
    embed.set_author(
        name='Nike',
        icon=
        'https://static-breeze.nike.co.kr/kr/ko_kr/cmsstatic/theme/52/android-icon-36x36.png'
    )

    # Set product details
    if (alert_type == "RESTOCK"):
        embed.set_desc("RESTOCK: " + "title")
    elif (alert_type == "NEW"):
        embed.set_desc("NEW: " + product.title)
    # Name, Code, Color, Date, Price
    # Early Link
    # Time
    embed.add_field(name="Name", value=product.name)
    embed.add_field(name="Code", value=product.code)
    embed.add_field(name="Color", value=product.color)
    embed.add_field(name="Price", value=product.price)
    embed.add_field(name="Link", value=product.siteLink)
    embed.add_field(name="Time", value=product.pTime)
    embed.add_field(name="ImgLink", value=product.imgLink)

    # Set product image
    embed.set_thumbnail(product.imgLink)
    embed.set_image(product.imgLink)

    # Set footer
    embed.set_footer(
        text='Nike by @DevHong',
        icon=
        'https://static-breeze.nike.co.kr/kr/ko_kr/cmsstatic/theme/52/android-icon-36x36.png',
        ts=True)
    # Send Discord alert
    embed.post()
コード例 #7
0
def push_data_to_discord_webhook(data, webhookid, webhookkey):
    """[summary]
    Pushes data to discord web-hook
    Arguments:
        data {[dictionary]} -- [data]
        webhookid {[string]} -- [webhook id]
        webhookkey {[string]} -- [key]
    """

    if data != None:
        url = 'https://discordapp.com/api/webhooks/{}/{}'.format(
            webhookid, webhookkey)
        content = "Price {} \nLast Update {} \nChange {}".format(
            data['price'], data['lastupdate'], data['change'])
        msg = Webhook(url, msg=content)
        msg.add_field(name="Field", value='Test Text')
        msg.post()
コード例 #8
0
ファイル: other-sites.py プロジェクト: nikodemes/sup-monitor
def send_embed(product):
    '''
    (Product) -> None
    Sends a discord alert based on info provided.
    '''

    url = 'INSERT YOUR WEBHOOK HERE'

    embed = Webhook(url, color=123123)

    embed.set_author(name='NERYS', icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg')
    embed.set_desc("Found product based on keyword " + product.keyword)

    embed.add_field(name="Link", value=product.link)

    embed.set_footer(text='NERYS by @snivynGOD', icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg', ts=True)

    embed.post()
コード例 #9
0
def send_embed(product):
    '''
    (Product) -> None
    Sends a discord alert based on info provided.
    '''

    url = 'WEBHOOK HERE'

    embed = Webhook(url, color=42320)

    embed.set_author(name='MY-Monitor')
    embed.set_desc("Found product based on keyword " + product.keyword)

    embed.add_field(name="Link", value=product.link)

    embed.set_footer(text='by keem#0815, Notify Beta', ts=True)

    embed.post()
コード例 #10
0
def send_embed(product):
    '''
    (Product) -> None
    Sends a discord alert based on info provided.
    '''

    url = "https://discord.com/api/webhooks/811178312336277504/ekKQ7L_aSJSbBWRiD7xH9PrcjeibAIG6P-KhMkVCLWDggsgzRSqSljNPQKPFkFSm69Mj"

    embed = Webhook(url, color=123123)

    embed.set_author(name='NERYS', icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg')
    embed.set_desc("Found product based on keyword " + product.keyword)

    embed.add_field(name="Link", value=product.link)

    embed.set_footer(text='NERYS by @snivynGOD', icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg', ts=True)

    embed.post()
コード例 #11
0
def send_embed(product):
    '''
    (Product) -> None
    Sends a discord alert based on info provided.
    '''

    url = 'https://discordapp.com/api/webhooks/479049758254825472/kmK_bdEZ_bH_fmDoGJ_rS2AB1Xedn2CHwiviMhzGbaxZ9ES5U8nTCorV6qQnRVd12mp_'

    embed = Webhook(url, color=123123)

    embed.set_author(name='Premier Cooks', icon='https://pbs.twimg.com/profile_images/1031725580075585536/s0GlPWIB_400x400.jpg')
    embed.set_desc("Found product based on keyword " + product.keyword)

    embed.add_field(name="Link", value=product.link)

    embed.set_footer(text='Nike Monitor by @PremierCooks', icon='https://pbs.twimg.com/profile_images/1031725580075585536/s0GlPWIB_400x400.jpg', ts=True)

    embed.post()
コード例 #12
0
def send_embed(product):
    '''
    (Product) -> None
    Sends a discord alert based on info provided.
    '''

    url = 'https://discordapp.com/api/webhooks/532298624114229268/pgNC5uyKSNOzitqRbm60E7G9p-fcjzhwHsss1biNP9TuxwbqNJbdj5y9HDtISSsf4yCc'

    embed = Webhook(url, color=123123)

    embed.set_author(name='NERYS', icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg')
    embed.set_desc("Found product based on keyword " + product.keyword)

    embed.add_field(name="Link", value=product.link)

    embed.set_footer(text='NERYS by @snivynGOD', icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg', ts=True)

    embed.post()
コード例 #13
0
def webhook(link, currency, photo, title, description, ino):
    link = 'https://www.supremenewyork.com' + link.rstrip()
    url = "<WEBHOOK>"
    embed = Webhook(url, color=123123)
    embed.set_desc("RESTOCK: [{0}]({1})".format(title, link))
    embed.add_field(name="Description", value=description)
    embed.add_field(name="Ino", value=ino)
    embed.add_field(name="Currency", value=currency)
    embed.add_field(name="Link", value=link)
    embed.set_thumbnail(photo)
    embed.set_footer(text='Powered by <COMPANY NAME>', ts=True, icon='<FOOTER ICON>')
    embed.post()
コード例 #14
0
def Run():
    time.sleep(5)
    print('偵測')
    artdata = np.load('artdata.npy').item()
    for lists in data['Item']:
        for user in lists['Users']:
            try:
                arts = pixiv.user(user).works()
                Userinfo = pixiv.user(user).User()
            except Exception as e:
                loginPixiv()
                continue

            for art in arts:
                try:
                    if artdata[user] == art.id:
                        break
                except Exception:
                    pass

                embed = Webhook(lists['WebhookURL'], color=123123)
                embed.set_author(
                    name=Userinfo['name'],
                    url='https://www.pixiv.net/member.php?id=' + user,
                    icon=UrlReplace(
                        Userinfo['profile_image_urls']['px_50x50']))
                embed.set_image(UrlReplace(art.image))
                embed.set_title(title=art.title, url=art.link)
                if not art.tags == None:
                    Tag = ''
                    for tags in art.tags:
                        Tag = Tag + tags + '、'
                    embed.add_field(name='標籤(Tags)', value=Tag[:-1])
                    Tag = ''
                if not art.caption == None:
                    embed.set_desc(art.caption)
                embed.set_footer(text=strmd,
                                 icon="https://i.imgur.com/UNPFf1f.jpg",
                                 ts=True)
                embed.post()

            artdata[user] = arts[0].id
    np.save('artdata.npy', artdata)
コード例 #15
0
def sendWebhook(checkoutUrl, totaltime, method, productName, pictureurl,
                webhook):
    embed = Webhook(webhook, color=123123)
    embed.set_author(name='Checkout/Queue Bypass Link', url=checkoutUrl)
    embed.add_field(name='Product Name', value=productName)
    embed.add_field(name='Total Time', value=totaltime)
    embed.add_field(name='Created by', value="rycao18#3998")
    embed.add_field(name='Method', value=method)
    embed.set_thumbnail(pictureurl)
    embed.set_footer(text='RyZySply Bot - ' + str(time.strftime("%H:%M:%S")),
                     icon='https://i.imgur.com/fG3Gu2Y.jpg',
                     ts=True)
    embed.post()
コード例 #16
0
def notify(product, slack, discord):

    times = []
    today = datetime.now()
    times.append(today)
    sizes = ""

    for size in product.stock_options:
        sizes += (size + " ")

    if slack:
        sc = slackweb.Slack(url=slack)
        attachments = []
        attachment = {
            "title": product.title,
            "color": "#EAF4EC",
            "text": product.link,
            "fields": [{
                "title": "Sizes",
                "value": sizes,
                "short": False
            }],
            "mrkdwn_in": ["text"],
            "thumb_url": product.image_url,
            "footer": "BBGR",
            "footer_icon":
            "https://platform.slack-edge.com/img/default_application_icon.png",
            "ts": time.time()
        }
        attachments.append(attachment)
        sc.notify(attachments=attachments)

    if discord:
        embed = Webhook(discord, color=0xEAF4EC)
        embed.set_title(title=product.title, url=product.link)
        embed.set_thumbnail(url=product.image_url)
        embed.add_field(name="Sizes", value=sizes)
        embed.set_footer(text='BBGR',
                         icon='https://cdn.discordapp.com/embed/avatars/0.png',
                         ts=True)
        embed.post()
コード例 #17
0
def send_embed(alert_type, product):
    '''
    (str, str, list, str, str, str) -> None
    Sends a discord alert based on info provided.
    '''
    # Set webhook
    url = https://discordapp.com/api/webhooks/555053278308859927/D1AsxzUajXuA3fchYuXwq_ib2OHW3S-UpNNYyYanoW7W2Eo9rBb-evVneSeRyPX_SOy7

    # Create embed to send to webhook
    embed = Webhook(url, color=123123)

    # Set author info
    embed.set_author(name='NERYS', icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg')

    # Set product details
    if(alert_type == "RESTOCK"):
        embed.set_desc("RESTOCK: " + product.title)
    elif(alert_type == "NEW"):
        embed.set_desc("NEW: " + product.title)

    embed.add_field(name="Product", value=product.title)
    embed.add_field(name="Link", value=product.link)
    embed.add_field(name="Stock", value=str(product.stock))

    # Set product image
    embed.set_thumbnail(product.image)
    embed.set_image(product.image)

    # Set footer
    embed.set_footer(text='NERYS by @snivynGOD', icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg', ts=True)

    # Send Discord alert
    embed.post()
コード例 #18
0
def send_embed(product):

    url = 'https://discordapp.com/api/webhooks/818881746308169749/TB7nvYzt6A4ZwJPEJzGFVzuRKpYRHR61Ka329pMCwWyF4fFwpV4Lt2lCdy1y8FljjkGz'

    embed = Webhook(url, color=123123)

    embed.set_author(
        name='ARB',
        icon=
        'https://sun9-74.userapi.com/impf/x8e2VAfW-ao86OPcoUeSKpB7sup-dlIC3bT-2g/I3Vwk9su7D8.jpg?size=564x532&quality=96&sign=423037df9ddf5c5400c93844710086c3&type=album'
    )
    embed.set_desc("Found product based on keyword " + product.keyword)

    embed.add_field(name="Link", value=product.link)

    embed.set_footer(
        text='ARB by @JaqueFresco',
        icon=
        'https://sun9-11.userapi.com/impf/DagUwT61wIcd0BeLtPOI3UFtf2nV2ZK9Gh-8NQ/ehNPfNbLWGA.jpg?size=754x750&quality=96&sign=ce4bfc72ef8fdcfbbf3c11dbd8589382&type=album',
        ts=True)

    embed.post()
コード例 #19
0
ファイル: shopify-sites.py プロジェクト: lovecahbka/rstck_mon
def send_embed(alert_type, link, fields, site, image, product):
    '''
    (str, str, list, str, str, str) -> None
    Sends a discord alert based on info provided.
    '''

    url = webhook

    embed = Webhook(url, color=123123)

    if (alert_type == "NEW_SHOPIFY"):
        desc = "NEW: " + product
    elif (alert_type == "RESTOCK_SHOPIFY"):
        desc = "RESTOCK: " + product

    embed.set_author(
        name='ARB',
        icon=
        'https://sun9-74.userapi.com/impf/x8e2VAfW-ao86OPcoUeSKpB7sup-dlIC3bT-2g/I3Vwk9su7D8.jpg?size=564x532&quality=96&sign=423037df9ddf5c5400c93844710086c3&type=album'
    )
    embed.set_desc(desc)

    for field in fields:
        if (alert_type == "NEW_SHOPIFY" or alert_type == "RESTOCK_SHOPIFY"):
            cart_link = site + "/cart/" + str(field[1]) + ":1"
            embed.add_field(name=str(field[0]), value=cart_link)

    if (image is not None):
        embed.set_thumbnail(image)
        embed.set_image(image)

    embed.set_footer(
        text='ARB by @JaqueFresco',
        icon=
        'https://sun9-11.userapi.com/impf/DagUwT61wIcd0BeLtPOI3UFtf2nV2ZK9Gh-8NQ/ehNPfNbLWGA.jpg?size=754x750&quality=96&sign=ce4bfc72ef8fdcfbbf3c11dbd8589382&type=album',
        ts=True)

    embed.post()
コード例 #20
0
def send_embed(product):
    '''
    (Product) -> None
    Sends a discord alert based on info provided.
    '''

    url = 'https://discordapp.com/api/webhooks/539724977209999370/WhJDAUZX1AqV6WagfJ8PEVIV9FiLjpYrh2zIP6eLu8794S4QF3etmqE22JBVQsn3auPl'

    embed = Webhook(url, color=123123)

    embed.set_author(
        name='NERYS',
        icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg')
    embed.set_desc("Found product based on keyword " + product.keyword)

    embed.add_field(name="Link", value=product.link)

    embed.set_footer(
        text='NERYS by @snivynGOD',
        icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg',
        ts=True)

    embed.post()
コード例 #21
0
def send_embed(product):
    '''
    (Product) -> None
    Sends a discord alert based on info provided.
    '''

    url = 'https://discordapp.com/api/webhooks/555053278308859927/D1AsxzUajXuA3fchYuXwq_ib2OHW3S-UpNNYyYanoW7W2Eo9rBb-evVneSeRyPX_SOy7'

    embed = Webhook(url, color=123123)

    embed.set_author(
        name='NERYS',
        icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg')
    embed.set_desc("Found product based on keyword " + product.keyword)

    embed.add_field(name="Link", value=product.link)

    embed.set_footer(
        text='NERYS by @snivynGOD',
        icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg',
        ts=True)

    embed.post()
コード例 #22
0
def send_embed(product):
    '''
    (Product) -> None
    Sends a discord alert based on info provided.
    '''

    url = 'https://discord.com/api/webhooks/728820147346997278/ocPnHwKHaeCLeq1N1UJ7nAmO1qvat3sxr2G5xv72TubAGZWmhajDzknK9CfR6ZpvxA2i'

    embed = Webhook(url, color=123123)

    embed.set_author(
        name='NERYS',
        icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg')
    embed.set_desc("Found product based on keyword " + product.keyword)

    embed.add_field(name="Link", value=product.link)

    embed.set_footer(
        text='NERYS by @snivynGOD',
        icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg',
        ts=True)

    embed.post()
コード例 #23
0
def send_embed(product):
    '''
    (Product) -> None
    Sends a discord alert based on info provided.
    '''

    url = 'https://discordapp.com/api/webhooks/587167482788446210/rWMXZRqEthmb8TZvWIM5MPYytAEkqVPEfmaTs1hu0cQ98qaBKFyg6Wxivk8tMonh9zJO'

    embed = Webhook(url, color=123123)

    embed.set_author(
        name='NERYS',
        icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg')
    embed.set_desc("Found product based on keyword " + product.keyword)

    embed.add_field(name="Link", value=product.link)

    embed.set_footer(
        text='NERYS by @snivynGOD',
        icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg',
        ts=True)

    embed.post()
コード例 #24
0
ファイル: other-sites.py プロジェクト: sammyngy/monitor
def send_embed(product):
    '''
    (Product) -> None
    Sends a discord alert based on info provided.
    '''

    url = 'https://discordapp.com/api/webhooks/609541516377194508/nJqkl98mdg9SvlF0pIZmJ-YY8EePCwQdfLJ-4oB4WJj3WR6Ve0LpzFZGHcOLrvDyxrAT'

    embed = Webhook(url, color=123123)

    embed.set_author(
        name='NERYS',
        icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg')
    embed.set_desc("Found product based on keyword " + product.keyword)

    embed.add_field(name="Link", value=product.link)

    embed.set_footer(
        text='NERYS by @snivynGOD',
        icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg',
        ts=True)

    embed.post()
コード例 #25
0
def send_embed(product):
    '''
    (Product) -> None
    Sends a discord alert based on info provided.
    '''

    url = 'https://discordapp.com/api/webhooks/481411222118465550/8TanFM9unt2Ztf_ySUGlus9MNw9DVDaTKNXAQZpMYvtnoucHevzCYn0gjwV_ZpQmKsTQ'

    embed = Webhook(url, color=123123)

    embed.set_author(
        name='NERYS',
        icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg')
    embed.set_desc("Found product based on keyword " + product.keyword)

    embed.add_field(name="Link", value=product.link)

    embed.set_footer(
        text='NERYS by @snivynGOD',
        icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg',
        ts=True)

    embed.post()
コード例 #26
0
ファイル: other-sites.py プロジェクト: yonhir-d/snk
def send_embed(product):
    '''
    (Product) -> None
    Sends a discord alert based on info provided.
    '''

    url = 'https://discordapp.com/api/webhooks/467639983512092682/LSRvJNEmNPI4ZBF-Qt0NHcVVmQNRsBwE_3hdJVMDX-kSaNEEU-8UB-nt-yxU5m7n5Qw6'

    embed = Webhook(url, color=123123)

    embed.set_author(
        name='NERYS',
        icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg')
    embed.set_desc("Found product based on keyword " + product.keyword)

    embed.add_field(name="Link", value=product.link)

    embed.set_footer(
        text='NERYS by @snivynGOD',
        icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg',
        ts=True)

    embed.post()
コード例 #27
0
        def on_status(self, status):
            print("New tweet from monitored handle:")
            print(status.text)
            ifvoid = 0
            #finds "RT" in first 2 characters of a tweet (retweet)
            if((str(status.text[:2]).find("RT")) != -1):
                print("This is a retweet or someone abusing the negative filter, we'll ignore this!")
                ifvoid = 1

            #finds "https://" anywhere in the tweet"
            elif((str(status.text).find("https://")) != -1 and ifvoid == 0):
                print("This tweet is an image or link!")

                #sends tweet contents to discord
                embed = Webhook(url)
                embed.set_desc("@everyone - NEW LINK/IMAGE FROM " + handle + ":")
                embed.add_field(name="Tweet Contents", value=str(status.text))
                embed.set_footer(text="Twitter Monitor by @__ized on twitter",ts=True)

                embed.post()

                print("Tweet Sent to Discord!")

                #finds and sends expanded url to discord
                foundurls = re.findall(r'(https?://\S+)', str(status.text))
                urlnumber = len(foundurls)
                print("Number of URLs in tweet: " + urlnumber)
                currenturl = 1
                while currenturl <= urlnumber:
                    uri = urlexpander.unshorten(foundurls[currenturl - 1])
                    
                    embed = Webhook(url)
                    embed.set_desc("Expanded URL:")
                    embed.add_field(name="-->", value=uri)
                    embed.set_footer(text="Twitter Monitor by @__ized on twitter",ts=True)

                    embed.post()

                    currenturl = currenturl + 1

                    print("Expanded URL " + uri + " Sent To Discord!")

            #finds "@" in the first character of a tweet (reply)
            elif((str(status.text[:1]).find("@")) == 0 and ifvoid == 0):
                print("This is likely a reply or other tweet, will not send")

            else:
                print("This is a regualr tweet, will send!")

                embed = Webhook(url)
                embed.set_desc("New tweet from " + handle + ":")
                embed.add_field(name="Tweet Contents", value=str(status.text))
                embed.set_footer(text="Twitter Monitor by @__ized on twitter",ts=True)

                embed.post()
コード例 #28
0
def send_embed(alert_type, product):
    '''
    (str, str, list, str, str, str) -> None
    Sends a discord alert based on info provided.
    '''
    # Set webhook
    url = discord_webhook

    # Create embed to send to webhook
    # msg='@everyone' option making everyone msg method
    if (alert_type == "KNEW"):
        embed = Webhook(url, color=123123, msg='@everyone')
    else:
        embed = Webhook(url, color=123123)

    # Set author info
    embed.set_author(
        name='Mrporter',
        icon=
        'https://previews.123rf.com/images/martialred/martialred1604/martialred160400080/55731598-%EB%A9%94%EC%8B%9C%EC%A7%80-%EC%95%B1%EA%B3%BC-%EC%9B%B9-%EC%82%AC%EC%9D%B4%ED%8A%B8%EC%97%90-%EB%8C%80%ED%95%9C-chatbot-%EC%B1%84%ED%8C%85-%EB%B4%87-%EB%98%90%EB%8A%94-%EC%B1%84%ED%84%B0-%EB%B4%87-%EB%9D%BC%EC%9D%B8-%EC%95%84%ED%8A%B8-%EC%95%84%EC%9D%B4%EC%BD%98.jpg'
    )

    # Set product details
    if (alert_type == "RESTOCK"):
        embed.set_desc("RESTOCK: " + "title")
    elif (alert_type == "NEW"):
        embed.set_desc("NEW: " + product.name)
    elif (alert_type == "KNEW"):
        embed.set_desc("NEW: " + product.name)

    embed.add_field(name="Product", value=product.name)
    embed.add_field(name="Brand", value=product.brand)
    embed.add_field(name="Price", value=product.price)
    embed.add_field(name="Link", value=product.siteLik)
    #embed.add_field(name="ImgLink", value=product.link)

    # Set product image
    embed.set_thumbnail(product.link)
    embed.set_image(product.link)
    print(product.link)
    input()

    # Set footer
    embed.set_footer(
        text='Mrporter by @DevHong',
        icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg',
        ts=True)

    # Send Discord alert
    embed.post()
コード例 #29
0
def send_embed(alert_type, product):
    '''
    (str, str, list, str, str, str) -> None
    Sends a discord alert based on info provided.
    '''
    # Set webhook
    url = webhook_url
    #url = 'https://discordapp.com/api/webhooks/481411222118465550/8TanFM9unt2Ztf_ySUGlus9MNw9DVDaTKNXAQZpMYvtnoucHevzCYn0gjwV_ZpQmKsTQ'

    # Create embed to send to webhook
    embed = Webhook(url, color=123123)

    # Set author info
    embed.set_author(
        name='Mrporter',
        icon=
        'https://previews.123rf.com/images/martialred/martialred1604/martialred160400080/55731598-%EB%A9%94%EC%8B%9C%EC%A7%80-%EC%95%B1%EA%B3%BC-%EC%9B%B9-%EC%82%AC%EC%9D%B4%ED%8A%B8%EC%97%90-%EB%8C%80%ED%95%9C-chatbot-%EC%B1%84%ED%8C%85-%EB%B4%87-%EB%98%90%EB%8A%94-%EC%B1%84%ED%84%B0-%EB%B4%87-%EB%9D%BC%EC%9D%B8-%EC%95%84%ED%8A%B8-%EC%95%84%EC%9D%B4%EC%BD%98.jpg'
    )

    # Set product details
    if (alert_type == "RESTOCK"):
        embed.set_desc("RESTOCK: " + "title")
    elif (alert_type == "NEW"):
        embed.set_desc("NEW: " + product.name)

    embed.add_field(name="Product", value=product.name)
    embed.add_field(name="Brand", value=product.brand)
    embed.add_field(name="Price", value=product.price)
    embed.add_field(name="Link", value=product.siteLik)
    embed.add_field(name="ImgLink", value=product.link)

    # Set product image
    #embed.set_thumbnail('https://cache.mrporter.com/images/products/1054353/1054353_mrp_fr_l.jpg')
    #embed.set_image(product.link)

    # Set footer
    embed.set_footer(
        text='Mrporter by @DevHong',
        icon='https://static.zerochan.net/Daenerys.Targaryen.full.2190849.jpg',
        ts=True)

    # Send Discord alert
    embed.post()
コード例 #30
0
def send_embed(alert_type, product):
    '''
    (str, str, list, str, str, str) -> None
    Sends a discord alert based on info provided.
    '''
    # Set webhook
    url = discord_webhook

    # Create embed to send to webhook
    embed = Webhook(url, color=123123)

    # Set author info
    embed.set_author(
        name='Premier Cooks',
        icon=
        'https://pbs.twimg.com/profile_images/1031725580075585536/s0GlPWIB_400x400.jpg'
    )

    # Set product details
    if (alert_type == "RESTOCK"):
        embed.set_desc("RESTOCK: " + product.title)
    elif (alert_type == "NEW"):
        embed.set_desc("NEW: " + product.title)

    embed.add_field(name="Product", value=product.title)
    embed.add_field(name="Link", value=product.link)
    embed.add_field(name="Stock", value=str(product.stock))

    # Set product image
    embed.set_thumbnail(product.image)
    embed.set_image(product.image)

    # Set footer
    embed.set_footer(
        text='Supreme Monitor by @premiercooks',
        icon=
        'https://pbs.twimg.com/profile_images/1031725580075585536/s0GlPWIB_400x400.jpg',
        ts=True)

    # Send Discord alert
    embed.post()