blizzard.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:FlapJack-Cogs 作者: flapjax 项目源码 文件源码
def print_token(self, url, realm):

        thumb_url = 'http://wowtokenprices.com/assets/wowtokeninterlaced.png'

        try:
            async with aiohttp.get(url, headers=self.header) as response:
                soup = BeautifulSoup(await response.text(), "html.parser")

            data = soup.find('div', class_=realm + '-region-div')
            desc = data.div.a.h3.text
            buy_price = data.div.find('p', class_='money-text').text
            trend = data.div.find('span', class_='money-text-small').text
            # Update time broken, returns --:-- -- when requested by bot
            #updated = data.div.find('p', id=realm + '-datetime').text

            embed = discord.Embed(title='WoW Token Info', description=desc, colour=0xFFD966)
            embed.set_thumbnail(url=thumb_url)
            embed.add_field(name='Buy Price', value=buy_price, inline=False)
            embed.add_field(name='Change', value=trend, inline=False)
            #embed.set_footer(text='Updated: ' + updated)

            await self.bot.say(embed=embed)

        except:
            await self.bot.say("Error finding WoW token prices.")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号