def send_to_discord(self, altered_sizes):
        hook = Webhook(self.webhook)
        hook.username = "******"
        hook.avatar_url = "https://pbs.twimg.com/profile_images/1001585704303030273/SNhhIYL8_400x400.jpg"

        # create embed
        embed = Embed(title='%s on Adidas %s' %
                      (self.pid, self.region.upper()),
                      url=self.get_wishlist_url(),
                      color=10764258,
                      timestamp='now')

        # add embed fields
        embed.add_field(name='PID', value=self.pid)
        embed.add_field(name='Region', value=self.region.upper())
        embed.add_field(name='Overall Status',
                        value=self.latest_status,
                        inline=False)

        for size in altered_sizes:
            embed.add_field(name='Size %s' % size['size'],
                            value=size['availability_status'],
                            inline=True)

        embed.set_footer(text='SD Adidas Monitor',
                         icon_url='https://i.imgur.com/ceVbiGI.png')
        hook.send(embed=embed)
        self.log("Posted status update to Discord")
示例#2
0
    def send_to_discord(self):
        hook = Webhook(self.webhook)
        hook.username = "******"
        hook.avatar_url = "https://pbs.twimg.com/profile_images/1001585704303030273/SNhhIYL8_400x400.jpg"

        embed = Embed(description='Status update on %s on Adidas %s' %
                      (self.pid, self.region.upper()),
                      color=0x1e0f3,
                      timestamp='now')

        embed.add_field(name='Status', value=self.latest_status)
        embed.set_footer(text='SD Adidas Monitor',
                         icon_url='https://i.imgur.com/ceVbiGI.png')
        hook.send(embed=embed)
        self.log("Posted status update to Discord")
示例#3
0
    def alert_new_car(self, car):
        self.log('New match found: {}'.format(car))

        embed = Embed(
            title='Match found: {}'.format(str(car)),
            url='https://www.tesla.com/en_GB/new/{}?redirect=no'.format(
                car.vin),
            color=10764258,
            timestamp='now')

        # set the footer
        embed.set_footer(text='Tesla Monitor')

        # send the embed to each webhook
        for webhook in self.webhooks:
            try:
                hook = Webhook(webhook)
                hook.username = "******"
                hook.avatar_url = "https://pbs.twimg.com/profile_images/1001585704303030273/SNhhIYL8_400x400.jpg"
                hook.send(embed=embed)
                self.log("Posted status update to Discord webhook {}".format(
                    webhook))
            except:
                self.log("Error sending to Discord webhook {}".format(webhook))