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.")
评论列表
文章目录