From 48e0a753794b9c471cc8acecef9e37c35e533143 Mon Sep 17 00:00:00 2001 From: SosoM1k0r31z31 Date: Sun, 8 Nov 2020 20:36:41 +0300 Subject: [PATCH] add character search --- bot.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bot.py b/bot.py index 1f05b03..5086705 100644 --- a/bot.py +++ b/bot.py @@ -1491,4 +1491,18 @@ async def anchovy(ctx): anchovy = secrets.choice(lines) await ctx.send(f"{anchovy}") +@bot.command() +async def character(ctx, *, char): + url = "https://api.jikan.moe/v3/search/character?q=mako-reizei&page=1" + headers = {'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0'} + + r = requests.get(url, headers=headers) + s = r.json() + + name = (s['results'][0]['name']) + image = (s['results'][0]['image_url']) + + await ctx.send(f"Search result\n{image}\n`{name}`") + + bot.run(TOKEN)