def _server_tibia(self, servername):
"""Get Server Info"""
servername = servername.title()
url = "https://secure.tibia.com/community/?subtopic=worlds&world=" + str(servername)
try:
async with aiohttp.get(url) as response:
soup = BeautifulSoup(await response.text(), "html5lib")
b = soup.find_all("table", attrs={'class': 'Table1'})
new = []
rows = b[1].tbody.div.find_all('td')
for row in rows:
new.append(row.get_text())
k = new[::2]
l = new[1::2]
zipped = list(zip(k, l))
t = tabulate(zipped, headers=["Category", "Info"])
await self.bot.say("```Python" + "\n" + str(t) + "```")
except:
await self.bot.say("Unable to retrive server data. The webserver may be offline.")
评论列表
文章目录