コード例 #1
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()
コード例 #2
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()
コード例 #3
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()
コード例 #4
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()
コード例 #5
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()
コード例 #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 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)
コード例 #8
0
ファイル: vkdiscord.py プロジェクト: 21zaber/VKDiscord
def proccess_new_post(post):
    global max_post_id

    # check for new post
    if int(post['id']) <= max_post_id:
        return
    max_post_id = int(post['id'])

    # search for photos in attachments
    photos = []
    for atch in post.get('attachments', []):
        if atch.get('type') == 'photo':
            photo = atch.get('photo', {})

            photo_urls = [i for i in photo.keys() if i.startswith('photo_')]
            photo_urls.sort(key=lambda x: -int(x.split('_')[-1]))

            if photo_urls and photo_urls[0]:
                photos.append(photo[photo_urls[0]])

    # generate text
    msg = post.get('text', '')

    # add all photos links from attachments. COMMENTED
    if False:
        msg += '\n'
        for i in photos:
            msg += '\n' + i

    # create Webhook object
    wh = Webhook(config['discord_webhook_url'], msg=msg)
    wh.set_footer(text='https://vk.com/wall-{}_{}'.format(
        config['vk_group_id'], post['id']),
                  ts=time.time())

    # set image
    if photos:
        wh.set_image(photos[0])

    # send Webhook to discord server
    wh.post()
コード例 #9
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()
コード例 #10
0
ファイル: supreme.py プロジェクト: lovecahbka/rstck_mon
def send_embed(alert_type, product):
    url = discord_webhook
    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')
    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='ARB by @JaqueFresco', icon='https://sun9-11.userapi.com/impf/DagUwT61wIcd0BeLtPOI3UFtf2nV2ZK9Gh-8NQ/ehNPfNbLWGA.jpg?size=754x750&quality=96&sign=ce4bfc72ef8fdcfbbf3c11dbd8589382&type=album', ts=True)

    # Send Discord alert
    embed.post()
コード例 #11
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()
コード例 #12
0
ファイル: supreme.py プロジェクト: gearbolt/shopifymonitor
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='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()
コード例 #13
0
BotWebHook = 'Your webhook url'
res.encoding = 'utf-8'
soup = BeautifulSoup(res.text, "html.parser")

PostLists = soup.find('table', {'class': 'b-list'})
Posts = PostLists.find_all('tr', {'class': 'b-list__row'})
Title = Posts[0].find('td', {'class': 'b-list__main'}).text
WebsiteUrl = 'https://forum.gamer.com.tw/' + Posts[0].find(
    'td', {
        'class': 'b-list__main'
    }).a['href']
sha1 = hashlib.sha1((Title).encode("utf-8")).hexdigest()
checkvalue = check('18c8', sha1)

embed = Webhook(BotWebHook, color=123123)
embed.set_author(name='Steamти┤тЊѕтДєуЅ╣тЁЇУ▓╗жЂіТѕ▓ТЃЁта▒', icon='')
embed.set_desc(Title + WebsiteUrl)
#embed.add_field(name='Test Field',value='Value of the field \U0001f62e')
#embed.add_field(name='Another Field',value='1234 ­Ъўё')
#embed.set_thumbnail('https://i.imgur.com/rdm3W9t.png')
embed.set_image(
    'https://pbs.twimg.com/profile_images/663739181231792128/58-mQCZh_400x400.png'
)
#embed.set_footer(text='уЎ╝ТќЄТЎѓжќЊ '+post_time,icon='',ts=True)

if (checkvalue == 1):
    print("No")
elif (checkvalue == 0):
    embed.post()

#embed.post()
コード例 #14
0
        


BotWebHook = 'Your webhook url'


HTMLCode = getHTMLCode('https://www.facebook.com/pg/Closers.Information/posts/?ref=page_internal')
PostsLists = HTMLCode.find('div',{'class':'_2pie _14i5 _1qkq _1qkx'})
PostList = PostsLists.find('div',{'class':'_1xnd'})
Posts = PostList.find_all('div',{'class':'_1dwg _1w_m _q7o'})


try:
    Img = getImgUrl(1)
except:
    Img = 'https://i.imgur.com/08ovhYT.png'
finally:
    Messages = getMessages(1)
    PostUrl = getPostUrl(1)

sha1 = hashlib.sha1((PostUrl).encode("utf-8")).hexdigest()
if check('ClosersInfo',sha1)==0:
    embed = Webhook(BotWebHook, color=123123)
    embed.set_author(name=Messages, icon='https://scontent.fkhh1-2.fna.fbcdn.net/v/t1.0-1/p200x200/25498185_1451951624922509_2329157679259274468_n.jpg?_nc_cat=0&oh=adae6bb11de458c0ef8bd63cd4c6b1cd&oe=5BD7BB91')
    embed.set_desc(PostUrl)
    #embed.add_field(name='Test Field',value='Value of the field \U0001f62e')
    #embed.add_field(name='Another Field',value='1234 😄')
    #embed.set_thumbnail('https://i.imgur.com/rdm3W9t.png')
    embed.set_image(Img)
    #embed.set_footer(text='發文時間 '+post_time,icon='',ts=True)
    embed.post()
コード例 #15
0
ファイル: example.py プロジェクト: hyns7/discordpyhooks
from discord_hooks import Webhook
WEBHOOK_URL = 'ADD YOUR WEBHOOK URL HERE'

embed = Webhook(
    url=WEBHOOK_URL,
    username='******', # Username of the 'bot'
    color=123123,   # Colour of the side of the embed
)

embed.set_author(name='Author Goes Here', icon='https://i.imgur.com/rdm3W9t.png', url='https://discordapp.com/')
embed.set_title(title='title ~~(did you know you can have markdown here too?)~~', url='https://discordapp.com/')
embed.set_desc("this description supports [named links](https://discordapp.com) as well. ```\nyes, even code blocks```")
embed.add_field(name="Field 1 \U0001f603", value="some of these properties have certain limits...",inline=False)
embed.add_field(name="Field 2 😱", value="try exceeding some of them!",inline=False)
embed.add_field(name="Field 3 🙄", value="Jokes, dont do that.",inline=False)
embed.add_field(name="Field 4 🙄", value="these last two")
embed.add_field(name="Field 5 🙄", value="are inline fields")
# Set the timestamp to either a ISO 8601 timestamp, or simply use `now=True`, which uses current time
embed.set_timestamp(time='2018-04-30T05:34:26-07:00')
embed.set_thumbnail('https://cdn.discordapp.com/embed/avatars/0.png')
embed.set_image('https://cdn.discordapp.com/embed/avatars/0.png')
embed.set_footer(text='Time Stamp is here =>',ts=True,icon='https://cdn.discordapp.com/embed/avatars/0.png')

embed.post()