add character search
This commit is contained in:
parent
41a75ed98e
commit
48e0a75379
14
bot.py
14
bot.py
|
@ -1491,4 +1491,18 @@ async def anchovy(ctx):
|
||||||
anchovy = secrets.choice(lines)
|
anchovy = secrets.choice(lines)
|
||||||
await ctx.send(f"{anchovy}")
|
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)
|
bot.run(TOKEN)
|
||||||
|
|
Loading…
Reference in New Issue