added logging
This commit is contained in:
parent
c11f16a5d8
commit
820c4fa8c6
1 changed files with 4 additions and 4 deletions
|
|
@ -9,7 +9,6 @@ class Anime(commands.Cog):
|
||||||
self.url = "https://api.waifu.im/search"
|
self.url = "https://api.waifu.im/search"
|
||||||
|
|
||||||
async def get_waifu(self, tags):
|
async def get_waifu(self, tags):
|
||||||
print(tags)
|
|
||||||
params = {
|
params = {
|
||||||
'included_tags': tags,
|
'included_tags': tags,
|
||||||
'height': '>=1000'
|
'height': '>=1000'
|
||||||
|
|
@ -21,14 +20,15 @@ class Anime(commands.Cog):
|
||||||
return image['url']
|
return image['url']
|
||||||
except:
|
except:
|
||||||
if resp_data['detail'] == "No image found matching the criteria given.":
|
if resp_data['detail'] == "No image found matching the criteria given.":
|
||||||
|
self.bot.logger.info("No image found matching the criteria given.")
|
||||||
return "No image found matching the criteria given."
|
return "No image found matching the criteria given."
|
||||||
else:
|
else:
|
||||||
|
self.bot.logger.exception("Something went wrong")
|
||||||
return "Something went wrong"
|
return "Something went wrong"
|
||||||
|
|
||||||
async def get_anime_from_img(self, img_url):
|
async def get_anime_from_img(self, img_url):
|
||||||
async with self.bot.http_session.get(f"https://api.trace.moe/search?anilistInfo&url={img_url}") as resp:
|
async with self.bot.http_session.get(f"https://api.trace.moe/search?anilistInfo&url={img_url}") as resp:
|
||||||
resp_data = await resp.json()
|
resp_data = await resp.json()
|
||||||
print(resp_data)
|
|
||||||
title = resp_data["result"][0]["anilist"]["title"]
|
title = resp_data["result"][0]["anilist"]["title"]
|
||||||
video = resp_data["result"][0]["video"]
|
video = resp_data["result"][0]["video"]
|
||||||
return title, video
|
return title, video
|
||||||
|
|
@ -73,6 +73,6 @@ class Anime(commands.Cog):
|
||||||
async def setup(bot):
|
async def setup(bot):
|
||||||
try:
|
try:
|
||||||
await bot.add_cog(Anime(bot))
|
await bot.add_cog(Anime(bot))
|
||||||
print("Successfully added Anime Cog")
|
bot.logger.info("Successfully added Anime Cog")
|
||||||
except:
|
except:
|
||||||
print("Failed to load Anime Cog")
|
bot.logger.info("Failed to load Anime Cog")
|
||||||
Loading…
Add table
Add a link
Reference in a new issue