Пример #1
0
def EmbedMsg():
    global Author
    global AuthorID
    global Title
    global Banner
    global RankedLink
    global Length
    global BPM
    global GMFormat
    global GMFormat2

    embed = Webhook(webhook, color=0x0098f9)
    embed.set_author(name='New {} map by {}'.format(GMFormat, Author),
                     icon='https://a.ppy.sh/{}'.format(AuthorID),
                     url='https://osu.ppy.sh/users/{}'.format(AuthorID))
    embed.set_title(title='**__{}__**'.format(Title), url=RankedLink)
    embed.set_thumbnail(Banner)
    embed.set_desc("""**BPM:** {}
**Song Length:** {}
**Containing:**
{}
""".format(BPM, Length, GMFormat2))
    embed.set_footer(text='Ranked!',
                     ts=True,
                     icon='https://hypercyte.s-ul.eu/W4GBjy0M')
    embed.post()

    NewRanked()
Пример #2
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)
Пример #3
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()
Пример #4
0
Файл: main.py Проект: tdk333/ch
    a = (a.json())
    a = a['items'][0]

    name = a['screenname']
    if name == 'Cointelegraph':
        picture = 'https://cointelegraph.com/assets/img/logo.png'
    else:
        picture = a['userpic'].replace('\\/', '/')

    title = a['header']
    content = a['text']
    link = a['permalink']
    if 'This is a paid-for submitted press release.' not in content:
        cursor.execute('''SELECT * FROM news where link="%s"''' % (link))
        if len(cursor.fetchall()) == 0:
            cursor.execute(
                '''DELETE FROM news where link=(SELECT link from news)''')
            cursor.execute('''INSERT INTO news VALUES(
            "%s",
            "%s",
            "%s",
            "%s",
            "%s")
            ''' % (name, title, content, link, picture))
            connection.commit()
            embed = Webhook(url, color=0x505358)
            embed.set_author(name=name, icon=picture)
            embed.set_title(title=title, url=link)
            embed.set_desc(parser.unescape(content.replace('<br>', '')))
            embed.post()
Пример #5
0
 nextPreStartTime = nextPreStartDt.strftime("%m/%d %I:%M:%S %p %Z")
 if goatData["product"]["name"] == productName:
     print(
         "({}) No new product detected. No action taken (Check OOS? = {})".
         format(logTime, lookForSoldOut))
 else:
     print("({}) New product detected. Sending webhooks (Check OOS? = {})".
           format(logTime, lookForSoldOut))
     productName = goatData["product"]["name"]
     lookForSoldOut = True
     for webhook in webhookUrls:
         embed = Webhook(webhook, color=123123)
         embed.set_author(name='Goat Surprise Monitor',
                          icon="https://i.imgur.com/GIOTCug.jpg")
         embed.set_thumbnail(url=goatData["product"]["pictureUrl"])
         embed.set_title(title=goatData["product"]["name"], url=productUrl)
         embed.set_desc(
             "The next drop usually occurs **10 minutes** after `Next Pre Start Time`.\nNext product is announced at `Next Pre Start Time`.\nClick [this]({}) to access product from website, (**Disclaimer:** Will not work on apparel)."
             .format(productUrl))
         embed.add_field(name='Price',
                         value="`${:,.2f}`".format(
                             goatData["product"]["priceCents"] / 100))
         embed.add_field(name='Pre Start Time',
                         value="`{}`".format(preStartTime))
         embed.add_field(name='Start Time', value="`{}`".format(startTime))
         embed.add_field(name='End Time', value="`{}`".format(endTime))
         embed.add_field(name='Next Pre Start Time',
                         value="`{}`".format(nextPreStartTime))
         embed.post()
 if lookForSoldOut == True:
     if "isSoldOut" in goatData:
Пример #6
0
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()
Пример #7
0
    #Creating a URL straight to the beatmap
    MapLink = "https://osu.ppy.sh/beatmapsets/{}".format(MapID)

    #------------------Printing the values to check it works---------------------------

    print('New {} map by {}'.format(GMFormat, Mapper))
    print('{}'.format(EmbedTitle))
    print("""**BPM:** {}
**Song Length:** {}
**Containing:**
{}
""".format(BPM, Length, GMFormat2))

    #------------------Programming and sending the embed itself------------------

    embed = Webhook(webhook, color=0xFFB6C1)
    embed.set_author(name='New {} map by {}'.format(GMFormat, Mapper),
                     icon='https://a.ppy.sh/{}'.format(MapperID),
                     url='https://osu.ppy.sh/users/{}'.format(MapperID))
    embed.set_title(title='**__{}__**'.format(EmbedTitle), url=MapLink)
    embed.set_thumbnail(Banner)
    embed.set_desc("""**BPM:** {}
**Song Length:** {}
**Containing:**
{}
""".format(BPM, Length, GMFormat2))
    embed.set_footer(text='Ranked!',
                     ts=True,
                     icon='https://hypercyte.s-ul.eu/W4GBjy0M')
    embed.post()