コード例 #1
0
def main():
    r = requests.get(droplist_link)
    soup = BeautifulSoup(r.text, "html.parser")
    cards = soup.find_all('div', {'class': 'col-md-3 col-sm-6 col-6'})
    for card in cards:
        item = card.find(
            "div", {
                "style":
                "text-align:center;margin-left:10px;margin-right:10px;margin-bottom:6px"
            }).text
        image = card.find(
            "img", {
                "style":
                "height:100%;width:100%;object-fit:cover;position:absolute;top:0;left:0"
            })["src"]

        webhook = DiscordWebhook(
            url=WebhookUrl,
            username='******',
            avatar_url=
            'https://banner2.cleanpng.com/20180813/vcb/kisspng-logo-brand-palace-skateboards-clothing--5b7141ef9e6801.6434516515341491036488.jpg'
        )
        embed = DiscordEmbed(title='Palace Droplist',
                             color=0xa020f0,
                             url=droplist_link)
        embed.set_image(url=image)
        embed.add_embed_field(name='Item:', value='**' + item + '**')
        embed.set_footer(text='Palace Droplist | Developed by DRB02#0001')
        webhook.add_embed(embed)
        time.sleep(0.5)
        webhook.execute()
        print("| WEBHOOK SENT |")
    else:
        print("End of list reached")
コード例 #2
0
ファイル: webhooks.py プロジェクト: Yasounet/shrpy
    def embed(self,
              title: str,
              description: str,
              url: str,
              deletion_url: str,
              is_file=False):
        """Creates DiscordEmbed instance using given arguments and adds it to webhook."""
        # Discord embed instance
        embed = DiscordEmbed()

        # Set title and description
        embed.set_title(title)
        embed.set_description(description)

        # Markdown links
        file_link = '**[Click here to view]({})**'.format(url)
        deletion_link = '**[Click here to delete]({})**'.format(deletion_url)

        # Add URL and deletion URL fields
        embed.add_embed_field(name='URL', value=file_link)
        embed.add_embed_field(name='Deletion URL', value=deletion_link)

        # Set random color
        embed.set_color(random_hex())

        # Add image to embed if url is image
        if is_file and url.endswith(('.mp4', '.webm')) is False:
            embed.set_image(url=url)

        # Add timestamp to embed
        embed.set_timestamp()

        # Add embed to webhook
        self.add_embed(embed)
コード例 #3
0
ファイル: views.py プロジェクト: Houston-ARTCC/zhu-core
    def put(self, request, event_id):
        """
        Post positions to designated events Discord channel.
        """
        event = get_object_or_404(Event, id=event_id)
        url = f'https://www.zhuartcc.org/events/{event.id}'
        webhook = DiscordWebhook(url=os.getenv('EVENTS_WEBHOOK_URL'))
        embed = DiscordEmbed(
            title=f':calendar: "{event.name}"',
            description=
            f'Below are the tentative event position assignments as they currently stand. Assignments are'
            f'subject to change on the day of the event so you should always double check the event page'
            f'before logging on to control.\n**[View the event page here!]({url})**',
            color='109cf1',
        )
        for position in event.positions.all():
            embed.add_embed_field(
                name=position.callsign,
                value='\n'.join([
                    f'`{i + 1}` *{shift.user.full_name}*'
                    if shift.user is not None else f'`{i + 1}`'
                    for i, shift in enumerate(position.shifts.all())
                ]),
            )
        embed.set_image(url=event.banner)
        webhook.add_embed(embed)
        res = webhook.execute()

        return Response(res.content, status=res.status_code)
コード例 #4
0
    def discord_notify(self):
        if 'DISCORD_WEBHOOK' not in os.environ:
            print(
                '[Discord] Not found required variable <{0}> in environment. SKIP!'
                .format('DISCORD_WEBHOOK'))
            return

        if not self.release_uploads:
            print('[Discord] Not found uploaded releases. SKIP!'.format(var))

        from discord_webhook import DiscordWebhook, DiscordEmbed

        if sys.platform.startswith('win'):
            _os = 'Windows'
            _color = 0x0F3674
        elif sys.platform.startswith('linux'):
            _os = 'Linux'
            _color = 0x20BF55
        else:
            _os = 'MacOS'
            _color = 0x31393C

        webhook = DiscordWebhook(url=os.environ['DISCORD_WEBHOOK'])
        embed = DiscordEmbed(
            title='[{2}] CSS:DM Build {0}.{1}'.format(self.src_version,
                                                      self.src_commit, _os),
            description='CSS:DM Build {0}.{1} available for download.'.format(
                self.src_version, self.src_commit),
            color=_color)

        for name, value in self.release_uploads.items():
            embed.add_embed_field(name=name, value=value)

        webhook.add_embed(embed)
        response = webhook.execute()
コード例 #5
0
ファイル: tools.py プロジェクト: nyartcc/StatsBot
def post_to_discord(prev_minutes, current_hours, tc_fname, tc_lname, tc_cid,
                    tc_hours):
    # create embed object for webhook
    embed = DiscordEmbed(
        title='Weekly Statistics',
        description='Statustics for the week of {}.{}.{}'.format(
            today.year, today.month, today.day),
        color=242424)

    # set image
    embed.set_thumbnail(
        url='https://image.prntscr.com/image/mTFpZeXOR8_lGUTO8gVg-Q.png')

    current_hours = round(current_hours / 60 / 60, 1)

    embed.add_embed_field(name='This Weeks Hours',
                          value='{}'.format(current_hours))
    embed.add_embed_field(name='Last Weeks Hours',
                          value='{}'.format(prev_minutes))
    embed2 = DiscordEmbed(
        title='This weeks top controller:',
        description='{0} {1} - CID: {2} with {3} hours! Congratulations!'.
        format(tc_fname, tc_lname, tc_cid, tc_hours),
        color=242424)

    # Post fun stuff to Discord
    webhook = DiscordWebhook(url=discord_webhook)

    # add embed object to webhook
    webhook.add_embed(embed)
    webhook.add_embed(embed2)
    webhook.execute()
コード例 #6
0
def main_function(count_num):
    twitter_client = TwitterClient()
    api = twitter_client.get_twitter_client_api()
    tweet_info = TweetInfo()

    discord_wh_url = twitterCred.DISCORD_WH_URL
    hook = DiscordWebhook(url=discord_wh_url, username='******')
    embed = DiscordEmbed(title='NEW TWEET', description='https://twitter.com/RestockWorld/with_replies?lang=en', color=242424)
    tweets = api.user_timeline(id='1075875489603076096', count=count_num)
    df = tweet_info.tweets_to_data_frame(tweets)

    print(df.head(count_num))

    if hasattr(tweets[0], 'retweeted_status'):
        pass
        # print('\nRETWEET')
    else:
        if 'media' in tweets[0].extended_entities:
            for image in tweets[0].extended_entities['media']:
                embed.set_image(url=image['media_url'])
        else:
            embed.set_image(url='http://proxy6006.appspot.com/u?purl=MDA1eDAwNTEvMDIxMDAxMzY1MS82OTA2NzAzMDY5ODQ1Nzg1NzAxL3NyZW5uYWJfZWxpZm9ycC9t%0Ab2MuZ21pd3Quc2JwLy86c3B0dGg%3D%0A')

        embed.set_thumbnail(url='https://twitter.com/RestockWorld/with_replies?lang=en')
        embed.add_embed_field(name='Tweet: ', value=tweets[0].text)
        embed.set_timestamp()
        hook.add_embed(embed)
        hook.execute()

    id_list = ['1075875489603076096']
    #'3309125130'

    twitter_streamer = TwitterStreamer()
    twitter_streamer.stream_tweets('tweets.json', id_list)
コード例 #7
0
def post_discord(imageUrl, title, status, styleColor, publishType,
                 exclusiveAccess, hardLaunch, price, availability, method,
                 Name, sizes):
    info = (
        f'Method: {method}   |   Type: {publishType}   |\n Price: {price}   |   Hard Launch: {hardLaunch}   |'
    )
    webhook = DiscordWebhook(url=webhookUrl, content='')
    embed = DiscordEmbed(
        title=f'{title} [ {status} ]',
        url='https://www.nike.com/launch/t/' + str(title),
        color=0x36393F,
        description=
        f' {Name} - {styleColor}\n  |  Avilable: {str(availability)}  | Exclusive: {exclusiveAccess}'
    )
    embed.add_embed_field(name='Info', value=info)
    embed.add_embed_field(name='Stock', value='\n'.join(sizes), inline=False)
    embed.set_author(
        name='@zyx898',
        icon_url=
        'https://pbs.twimg.com/profile_images/1118878674642714624/lNXTIWNT_400x400.jpg',
        url='https://twitter.com/zyx898')
    embed.set_thumbnail(url=imageUrl)
    embed.set_footer(
        text=Name + ' | SkrNotify',
        icon_url=
        'https://pbs.twimg.com/profile_images/1134245182738718721/N12NVkrt_400x400.jpg'
    )
    embed.set_timestamp()
    webhook.add_embed(embed)
    webhook.execute()
コード例 #8
0
    def social_webhook(img_url, raffle_name, shop_name, raffle_type, soup,
                       raffle_url):
        print("I'm in social")
        # Отправляем вебхук
        webhook = DiscordWebhook(url=WEBHOOK)

        # create embed object for webhook
        embed = DiscordEmbed(title=raffle_name,
                             description="[{0}]({1})".format(
                                 "Click here if no links", raffle_url),
                             color=10181046)

        # add embed object to webhook
        webhook.add_embed(embed)

        embed.set_author(
            name='Quasar Cook',
            icon_url=
            'https://sun9-66.userapi.com/c856032/v856032229/1e2b12/JTB-w2_3DzI.jpg'
        )
        embed.set_thumbnail(url=img_url)
        embed.add_embed_field(name='Type', value=raffle_type, inline=True)
        embed.add_embed_field(name='Store', value=shop_name, inline=True)
        embed.set_footer(text='Powered by Quasar Cook @hisoyem')

        response = webhook.execute()

        return insert_links_into_db(raffle_url)
コード例 #9
0
 def save(self, domain: str, *args, **kwargs):
     self.date = timezone.now()
     self.domain = domain
     super(AdminRightsRequest, self).save()
     group = get_object_from_full_slug(self.group)
     try:
         webhook = DiscordWebhook(
             url=settings.DISCORD_ADMIN_MODERATION_WEBHOOK)
         embed = DiscordEmbed(
             title=f'{self.student} demande à devenir admin de {group}',
             description=self.reason,
             color=242424)
         embed.add_embed_field(name='Accepter',
                               value=f"[Accepter]({self.accept_url})",
                               inline=True)
         embed.add_embed_field(name='Refuser',
                               value=f"[Refuser]({self.deny_url})",
                               inline=True)
         if (self.student.picture):
             embed.thumbnail = {"url": self.student.picture.url}
         webhook.add_embed(embed)
         webhook.execute()
     except Exception as e:
         logger.error(e)
     super(AdminRightsRequest, self).save()
コード例 #10
0
ファイル: triggers.py プロジェクト: Subject38/bemaniutils
    def broadcast_score_discord(self, data: Dict[str, str], game: str,
                                song: Song) -> None:
        if game == GameConstants.IIDX:
            now = datetime.now()

            webhook = DiscordWebhook(
                url=self.config['webhooks']['discord'][game])
            scoreembed = DiscordEmbed(title=f'New {game} Score!',
                                      color='fbba08')
            scoreembed.set_footer(text=(
                now.strftime('Score was recorded on %m/%d/%y at %H:%M:%S')))

            # lets give it an author
            song_url = f"{self.config['server']['uri']}/{game}/topscores/{song.id}" if self.config[
                'server']['uri'] is not None else None
            scoreembed.set_author(name=self.config['name'], url=song_url)
            for item in data:
                inline = True
                if item in ['DJ Name', 'Song', 'Artist', 'Play Stats']:
                    inline = False
                scoreembed.add_embed_field(name=item,
                                           value=data[item],
                                           inline=inline)
            webhook.add_embed(scoreembed)
            webhook.execute()
コード例 #11
0
ファイル: solebox.py プロジェクト: rtunazzz/Solebox-Tool
def sendSoleboxAccountWebhook(
    webhook_url: str, title: str, email: str, passwd: str
) -> None:
    """Sends a discord webhook to the `webhook_url`.
    
    Arguments:
        webhook_url {str} -- URL of a Discord webhook
        title {str} -- Title of the embed that's going to be sent
        email {str} -- Solebox account email
        passwd {str} -- Solebox account password
    """
    hook = DiscordWebhook(
        url=webhook_url,
        username="******",
        avatar_url="https://avatars1.githubusercontent.com/u/38296319?s=460&v=4",
    )
    color = 0xAB79F2

    embed = DiscordEmbed(
        title=title,
        color=color,
        url="https://github.com/rtunazzz/Solebox-Tool",
    )
    embed.set_timestamp()
    embed.set_footer(
        text="@rtunazzz | rtuna#4321",
        icon_url="https://avatars1.githubusercontent.com/u/38296319?s=460&v=4",
    )
    embed.add_embed_field(name="Username", value=f"{email}")
    embed.add_embed_field(name="Password", value=f"||{passwd}||", inline=False)
    hook.add_embed(embed)
    hook.execute()
コード例 #12
0
def message_post(webhook_url, title, image, restricrt, method, starttime):
    try:

        webhook = DiscordWebhook(url=webhook_url, content='')

        embed = DiscordEmbed(title=title,
                             color=0x00fea9,
                             url="https://nike.com/launch")

        embed.add_embed_field(name='**Product Infos:**',
                              value='Access: ' + restricrt + '\n\n' +
                              'Start Time: ' + starttime + '\n\n' +
                              'Release Type: ' + method)

        embed.set_thumbnail(url=image)

        embed.set_footer(
            text='@zyx898',
            icon_url=
            'https://pbs.twimg.com/profile_images/1118878674642714624/lNXTIWNT_400x400.jpg'
        )

        embed.set_timestamp()

        webhook.add_embed(embed)

        webhook.execute()

        print(gettime() + '[SUCCESS] --> Successfully sent success webhook!')
    except:
        print(gettime() + '[ERROR] --> Unable to send webhook')
        pass
コード例 #13
0
def post_event_webhook(event):
    if os.getenv('EVENTS_WEBHOOK_URL') is None:
        return

    url = f'https://www.zhuartcc.org/events/{event.id}'
    webhook = DiscordWebhook(url=os.getenv('EVENTS_WEBHOOK_URL'))
    embed = DiscordEmbed(
        title=f':calendar: {event.name}',
        description=str(event.description) +
        f'\n**[Sign up for the event here!]({url})**',
        color='109cf1',
    )
    embed.add_embed_field(
        name='Start & End',
        value=
        f'{event.start.strftime("%b %d, %Y @ %H%Mz")} - {event.end.strftime("%b %d, %Y @ %H%Mz")}',
        inline=False,
    )
    embed.add_embed_field(
        name='Presented by',
        value=event.host,
    )
    embed.set_image(url=event.banner)
    webhook.add_embed(embed)
    webhook.execute()
コード例 #14
0
def bonus_pack(request):
    admins = SteamUser.objects.filter(is_staff=True)
    player = request.user
    for admin in admins:
        new_message = PrivateMessages.objects.create(
            to_player_id=admin.id,
            from_player_name=player.personaname,
            from_player_name_slug=player.nickname,
            from_player_avatar=str(player.avatar),
            text='Я бы хотел попросить бонус пак .\n'
            ' Мой SteamID {} . '.format(player.steamid))
        new_message.save()
    player.bonus_pack = True
    player.save(force_update=True)
    messages.add_message(
        request, messages.SUCCESS,
        'Заявка на получение бонус-пака отправлена! '
        'Ожидай в дискорде сообщения от администрации сервера.')

    webhook = DiscordWebhook(url=bot_settings.SHOP_ADMIN_URL)
    embed = DiscordEmbed(title='ЗАЯВКА НА БОНУС ПАК', color=0xec4e00)
    embed.add_embed_field(name='Заказчик : ', value=player.personaname)
    embed.add_embed_field(name='STEAMID: ', value=player.steamid)

    webhook.add_embed(embed)

    webhook.execute()

    return HttpResponseRedirect('/profile/' + request.user.nickname)
コード例 #15
0
def main(keyword):
    keyword = keyword.strip()
    links = get_list(keyword)
    for k, link in enumerate(links):
        start_time = time.time()
        while True:
            webhook = DiscordWebhook(url=webhook_url)

            # create embed object for webhook
            embed = DiscordEmbed(title=link[0],
                                 description=link[1],
                                 color=242424)

            # set author
            embed.set_author(
                name='Amira',
                url='https://www.finewineandgoodspirits.com/',
                icon_url=
                'https://cdn2.f-cdn.com/ppic/159713777/logo/47568275/profile_logo_47568275.jpg'
            )

            # set image
            embed.set_image(url=link[2])

            # set thumbnail
            embed.set_thumbnail(
                url=
                'https://cdn5.f-cdn.com/ppic/57665018/logo/7568749/profile_logo_7568749.jpg'
            )

            # set footer
            embed.set_footer(text=keyword)

            # set timestamp (default is now)
            embed.set_timestamp()

            # add fields to embed
            embed.add_embed_field(name='Volume', value=link[3].strip())
            embed.add_embed_field(name='Price', value=link[4].strip())

            # add embed object to webhook
            webhook.add_embed(embed)
            res = webhook.execute()
            if res.status_code == 204:
                print('{} item of {} items on keyword: {}'.format(
                    k, len(links), keyword))
                break
            elif res.status_code == 429:
                retry_time = int(json.loads(res.text)['retry_after']) / 1000
                print('Waiting... | {} seconds'.format(retry_time))
                time.sleep(retry_time)
                continue
            elif time.time() - start_time > 120:
                print('Failed. Go to next item...')
                break
            else:
                print('Waiting for static time... {} seconds'.format(5))
                time.sleep(5)

    Thread(keyword).start()
コード例 #16
0
ファイル: und-monitor.py プロジェクト: venn0126/TCB
def send_webhook(webhookLink, productName, productLink, price, sizeList,
                 idList, hypePicLink):
    price_format = '${}'.format(price)
    # embed
    webhook = DiscordWebhook(
        url=webhookLink,
        username='******',
        avatar_url='https://cdn.cybersole.io/media/discord-logo.png')

    embed = DiscordEmbed(title=productName,
                         description=productLink,
                         color=65280)
    embed.add_embed_field(name='Price', value=price_format, inline=False)
    for index in range(len(sizeList)):
        carLink = 'https://undefeated.com/cart/{}:1'.format(idList[index])
        value_format = '[{}]({})'.format(idList[index], carLink)
        embed.add_embed_field(name=sizeList[index], value=value_format)

    embed.set_footer(
        text='AugusAIO',
        icon_url=
        'https://cdn.discordapp.com/attachments/569722032137437191/677350898556600355/kobe.jpg'
    )
    embed.set_timestamp()
    embed.set_thumbnail(url=hypePicLink)
    webhook.add_embed(embed)
    response = webhook.execute()
    print("数据发送中,请稍后...")
    if response.status_code == 204:
        print('恭喜🎉!!!undefeated库存更新通知发送成功!')
    else:
        print('很遗憾😭...undefeated库存更新通知发送失败,请检查输入参数.')
コード例 #17
0
ファイル: twitter.py プロジェクト: wtreston/twitter-v1
def check_url(account, user, account_index):
    global monitoring
    global SAVE
    global DISCORD_URL
    old_url = account[1][1]
    try:
        new_url = user.entities['url']['urls'][0]['expanded_url'].lower()
        if old_url != new_url:
            monitoring[account_index][1][1] = new_url
            screen_name = user.screen_name
            user_url = "https://www.twitter.com/{}".format(screen_name)
            webhook = DiscordWebhook(url=DISCORD_URL)
            embed = DiscordEmbed(color=0xE800FF)
            embed.set_author(
                name="{} changed their BIO URL...".format(screen_name),
                url=user_url,
                icon_url=user.profile_image_url_https)
            embed.add_embed_field(name='**OLD BIO URL**',
                                  value="**{}**".format(old_url),
                                  inline=True)
            embed.add_embed_field(name='**NEW BIO URL**',
                                  value="**{}**".format(new_url),
                                  inline=True)
            webhook.add_embed(embed)
            webhook.execute()
            SAVE = True
    except:
        pass
コード例 #18
0
def newProductFound(product_data, shop_name, webhook_url):
    # parse product data
    product_title = (product_data['title'])
    product_link = (f'https://{shop_name}.com/products/' +
                    product_data['handle'])
    product_image = (product_data['images'][0]['src'])

    # parse variant data
    variants = product_data['variants']
    price = ('$' + variants[0]['price'])
    sizes = {}
    for variant in variants:
        variant_size = variant['title']
        variant_id = variant['id']
        sizes[str(variant_size)] = variant_id

    quick_task = f'[QuickTask](https://cybersole.io/dashboard/tasks?quicktask={product_link})'

    # build size string
    size_string = ''
    for i in range(len(sizes)):
        size = str(list(sizes.keys())[i])
        id = str(list(sizes.values())[i])
        size_string += f'[{size}]' + f'(https://{shop_name}.com/cart/add/{id})\n'
    size_string += f'\n[QuickTask](https://cybersole.io/dashboard/tasks?quicktask={product_link})'

    # send discord notification
    webhook = DiscordWebhook(url=webhook_url)
    embed = DiscordEmbed(title=product_title, url=product_link, color=0x35e811)
    embed.set_thumbnail(url=product_image)
    embed.add_embed_field(name=price, value=size_string, inline=True)
    embed.set_footer(text=f'shopify-{shop_name} | made by bard#1704')
    webhook.add_embed(embed)
    webhook.execute()
コード例 #19
0
ファイル: webhooks.py プロジェクト: paullallier/FCMS
def cancel_jump(request, cid, webhook_url, override=False):
    mycarrier = request.dbsession.query(Carrier).filter(
        Carrier.id == cid).one_or_none()
    extra = request.dbsession.query(CarrierExtra).filter(
        CarrierExtra.cid == cid).one_or_none()
    embed = DiscordEmbed(
        title='Jump Cancelled',
        description=f'{util.from_hex(mycarrier.name)} has cancelled jump.',
        color=242424,
        url=f'https://fleetcarrier.space/carrier/{mycarrier.callsign}')
    embed.set_author(
        name='Fleetcarrier.space',
        url=f'https://fleetcarrier.space/carrier/{mycarrier.callsign}')
    if extra:
        embed.set_image(url=request.storage.url(extra.carrier_image))
    else:
        embed.set_image(
            url='https://fleetcarrier.space/static/img/carrier_default.png')
    if override:
        embed.set_image(
            url='https://media.giphy.com/media/B9NG8QJWN6pnG/giphy.gif')
    embed.set_footer(
        text='Fleetcarrier.space - Fleet Carrier Management System')
    embed.add_embed_field(name='Staying right here in ',
                          value=mycarrier.currentStarSystem)
    embed.set_timestamp(datetime.utcnow().timestamp())
    return send_webhook(webhook_url,
                        'Carrier Jump cancelled',
                        hooktype='discord',
                        myembed=embed,
                        refresh=False)
コード例 #20
0
def discord_webhook(callsign, name, cid, rating_long, server, status):

    webhook = DiscordWebhook(url=webhookurl)

    if status == "online":
        embed = DiscordEmbed(title=callsign + " - Online", description=callsign + ' is now online on the VATSIM network.', color=65290)
        embed.set_footer(text='ZDC VATSIM Notify Bot ' + version, icon_url='https://vzdc.org/photos/discordbot.png')
        embed.set_thumbnail(url='https://vzdc.org/photos/logo.png')
        embed.set_timestamp()
        embed.add_embed_field(name='Name', value=name)
        embed.add_embed_field(name='Rating', value=rating_long)
        embed.add_embed_field(name='CID', value=cid)
        embed.add_embed_field(name='Callsign', value=callsign)
        embed.add_embed_field(name='Server', value=server)

        webhook.add_embed(embed)
        webhook.execute()
        webhook.remove_embed(0)
        
    else:
        embed = DiscordEmbed(title=callsign + " - Offline", description=callsign + ' is now offline on the VATSIM network.', color=16711683)
        embed.set_footer(text='ZDC VATSIM Notify Bot ' + version, icon_url='https://vzdc.org/photos/discordbot.png')
        embed.set_thumbnail(url='https://vzdc.org/photos/logo.png')
        embed.set_timestamp()
        #embed.add_embed_field(name='Name', value=name)
        #embed.add_embed_field(name='Rating', value=rating_long)
        #embed.add_embed_field(name='CID', value=cid)
        #embed.add_embed_field(name='Callsign', value=callsign)
        #embed.add_embed_field(name='Server', value=server)

        webhook.add_embed(embed)
        webhook.execute()
        webhook.remove_embed(0)
コード例 #21
0
def monitor():
    list_of_notified_raffles = []
    while True:
        print ('Monitoring OTH Raffles...')
        s = requests.Session()
        url = 'https://offthehook.ca/pages/raffles'
        headers = {
            'sec-fetch-dest': 'document',
            'sec-fetch-mode': 'navigate',
            'sec-fetch-site': 'none',
            'sec-fetch-user': '******',
            'upgrade-insecure-requests': '1',
            'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'
            }
        raffle_list = s.get(url, headers=headers)
        soup = bs(raffle_list.text, 'lxml')
        existing_raffle_list = soup.find('div', {'class':'rte'})
        for data in existing_raffle_list('p'):
            #print (data.text)
            try:
                raffle_name = data.text
                if "ENDED" in raffle_name:
                    pass
                else:
                    if raffle_name in list_of_notified_raffles:
                        print ('Found in Notified Raffles Already, Should be moving on...')
                        pass
                    else:
                        raffle_link = data.a.get('href')
                        print ('Found Live Raffle! {}'.format(raffle_name))
                        raffle_page = s.get(raffle_link, headers=headers)
                        soup = bs(raffle_page.text, 'lxml')
                        picture_frame = soup.find('div', {'class':'rte'})
                        try:
                            product_image = picture_frame.img.get('src')
                            print ('IMAGE URL: {}'.format(product_image))
                        except:
                            print ('Error Finding Product Image')
                            pass
                        webhook_url = ''
                        webhook = DiscordWebhook(url=webhook_url)
                        embed = DiscordEmbed(title='{}'.format(raffle_name), url='{}'.format(raffle_link), color=10181046)
                        embed.add_embed_field(name='Region:', value='CA')
                        embed.add_embed_field(name='Site:', value='OFFTHEHOOK')
                        embed.add_embed_field(name='Release Type:', value='ONLINE')
                        embed.add_embed_field(name='Closes', value='UNKNOWN')
                        embed.add_embed_field(name='Entry', value='[Click Here]({})'.format(raffle_link))
                        embed.set_thumbnail(url='{}'.format(product_image))
                        embed.set_footer(text='Made by alin#8437')
                        embed.set_timestamp()
                        webhook.add_embed(embed)
                        webhook.execute()
                        list_of_notified_raffles.append(raffle_name)
                        print ('Change Detected! Sending Notification to Discord!')
                        time.sleep(2)
            except:
                print ('Exception Error')
                pass
        time.sleep(10)
def server_run_status(webhook_url):
    webhook = DiscordWebhook(webhook_url)
    embed = DiscordEmbed(title='Server Status', description='Server is online!', color=242424)
    embed.set_thumbnail(url='https://cdn.icon-icons.com/icons2/894/PNG/512/Tick_Mark_Circle_icon-icons.com_69145.png')
    embed.set_timestamp()
    embed.add_embed_field(name='Address', value=address)
    webhook.add_embed(embed)
    response = webhook.execute()
コード例 #23
0
ファイル: Logging.py プロジェクト: ncchase/chase21
def complete(script_name, year, data):
    embed = DiscordEmbed(title="Completed script " + script_name,
                         description="",
                         color=0x008000)
    embed.add_embed_field(name="Year " + str(year), value=data, inline=False)
    webhook.add_embed(embed)  # Add embed object to Webhook
    webhook.execute()  # Send Webhook
    webhook.remove_embed(0)  # Remove embed object
コード例 #24
0
 def send_embed(self, color, title, **kwargs):
     webhook = DiscordWebhook(url=self.WEBHOOK)
     embed = DiscordEmbed(title=title, color=color)
     embed.set_timestamp()
     for key in kwargs:
         embed.add_embed_field(name=key.upper(), value=str(kwargs[key]))
     webhook.add_embed(embed)
     return webhook.execute()
コード例 #25
0
ファイル: Logging.py プロジェクト: ncchase/chase21
def invalidFormResponse(year, data):
    embed = DiscordEmbed(title="Invalid Form Response", color=0xFFA500)
    embed.set_timestamp()
    embed.add_embed_field(name="Year " + str(year),
                          value=str(data),
                          inline=False)
    webhook.add_embed(embed)  # Add embed object to Webhook
    webhook.execute()  # Send Webhook
    webhook.remove_embed(0)  # Remove embed object
コード例 #26
0
def sendDiscordMessage(message, description_message):
    if ThreadedStart.discord_hook != "":
        hook = DiscordWebhook(url=ThreadedStart.discord_hook)
        embed = DiscordEmbed(title='[POTENCIAL SQLI]',
                             description=description_message,
                             color="1a1a1a")
        hook.add_embed(embed)
        embed.add_embed_field(name='URL:', value=message)
        hook.execute()
コード例 #27
0
 def send_store_closed_message(self):
     embed = DiscordEmbed(title="Store Update",
                          description="Store is closed",
                          color=242424)
     embed.add_embed_field(name="Website Link", value=self.website_url)
     embed.set_timestamp()
     self.webhook.add_embed(embed)
     self.webhook.execute()
     self.remove_embeds_from_webhook()
コード例 #28
0
ファイル: Logging.py プロジェクト: ncchase/chase21
def report():
    embed = DiscordEmbed(title="TITLE",
                         description="description",
                         color=0xFFFFFF)
    embed.set_timestamp()
    embed.add_embed_field()
    webhook.add_embed(embed)  # Add embed object to Webhook
    response = webhook.execute()  # Send Webhook
    webhook.remove_embed(0)  # Remove embed object
コード例 #29
0
def main():
    # When changing links, make sure to delete the database.json file
    hook = "https://discordapp.com/api/webhooks/698641374895145021/DpTKruC5Q_XgqBCBxTwBKMLJVSrQnxsFYbmDJONtagmV-NyYs0dK4SpHm_akIwLbqXb5"
    link = "https://moanabikini.com"
    try:
        with open("database.json", "r") as database:
            dbjson = loads(database.read())
            id_list = list(map(lambda prod: prod["id"], dbjson))
    except FileNotFoundError:
        print("Making Request")
        json = get_json(link)
        with open("database.json", "w") as database:
            dump(json, database)
        id_list = list(map(lambda prod: prod["id"], json))

    while True:
        print("Scraping")
        json = get_json(link)
        with open("database.json", "r") as database:
            dbjson = loads(database.read())

        for product in json:
            if product["id"] not in id_list:
                with open("database.json", "w") as database:
                    dump(json, database)
                print("New Item Found")
                webhook = DiscordWebhook(url=hook)
                embed = DiscordEmbed(title=product["title"])
                embed.set_image(url=product["images"][0]["src"])
                for variant in product["variants"]:
                    embed.add_embed_field(name=f'{variant["title"]} -- {variant["price"]}',
                                          value=f"[Purchase]({link}/cart/{variant['id']}:1) -- AVAILABLE: {variant['available']}",
                                          inline=True)
                webhook.add_embed(embed)
                webhook.execute()
                id_list.append(product["id"])
            else:
                for product2 in dbjson:
                    if product["id"] == product2["id"]:
                        for variant in product["variants"]:
                            for variant2 in product2["variants"]:
                                if (variant["id"] == variant2["id"]) and (not variant2["available"] and variant["available"]):
                                    webhook = DiscordWebhook(url=hook)
                                    embed = DiscordEmbed(
                                        title=f'{product["title"]} RESTOCK in size {variant["title"]}')
                                    embed.set_image(
                                        url=product["images"][0]["src"])
                                    for variant in product["variants"]:
                                        embed.add_embed_field(
                                            name=f'{variant["title"]} -- {variant["price"]}', value=f"[Purchase]({link}/cart/{variant['id']}:1) -- AVAILABLE: {variant['available']}", inline=True)
                                    webhook.add_embed(embed)
                                    webhook.execute()
                                    with open("database.json", "w") as database:
                                        dump(json, database)

        time.sleep(5)
    print(id_list)
コード例 #30
0
ファイル: betfury.py プロジェクト: xmess7/Betfury-Dicebot
def withdraw(balance):
    print("PROFIT TAKING ACHIEVED, Making 500 TRX Withdrawl")

    try:
        WEBHOOK_URL = discordwebhook
        webhook = DiscordWebhook(url=WEBHOOK_URL)
        # create embed object for webhook
        embed = DiscordEmbed(title='BetFury Dice Bot Beta',
                             description='View Latest Stats Below',
                             color=242424)
        # set timestamp (default is now)
        embed.set_timestamp()
        # add fields to embed
        embed.add_embed_field(name='Amount Withdrawn',
                              value=str(withdraw_amount))
        embed.add_embed_field(
            name='Make Bets On BetFury Here:',
            value='https://betfury.io/?r=5dbf4b990e74c14e9116b67e')
        # add embed object to webhook
        webhook.add_embed(embed)
        response = webhook.execute()
    except Exception as e:
        print(e)
        pass

    mouse.position = (1562, 133)
    mouse.press(Button.left)
    mouse.release(Button.left)

    sleep(7)
    #Wallet input press then input
    mouse.position = (842, 621)
    mouse.press(Button.left)
    mouse.release(Button.left)

    mouse.position = (842, 621)
    mouse.press(Button.left)
    mouse.release(Button.left)

    keyboard.write(wallet_address)

    sleep(1)

    #withdraw amount
    mouse.position = (860, 737)
    mouse.press(Button.left)
    mouse.release(Button.left)

    keyboard.write(str(withdraw_amount))
    sleep(1)
    #withdraw button
    mouse.position = (976, 833)
    mouse.press(Button.left)
    mouse.release(Button.left)

    sleep(12)