From 277e0ece618c5c11a2fef04f55a50cea109db111 Mon Sep 17 00:00:00 2001 From: SosoM1k0r31z31 Date: Fri, 13 Nov 2020 11:44:55 +0300 Subject: [PATCH] add proper dictionary --- bot.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bot.py b/bot.py index 182232c..bb40148 100644 --- a/bot.py +++ b/bot.py @@ -1534,5 +1534,21 @@ async def animesearch(ctx, *, anime): await ctx.send(f"Search result\n\n**Title:** {title}\n\n**Synopsis:** {synopsis}\n\n**Episodes:** {episodes}\n**Score:** {score}\n**Start date:** {start_date}\n**End date:** {end_date}\n\n{image}\n{name}`") +@bot.command() +async def define(ctx, *, term): + + url = f"https://api.dictionaryapi.dev/api/v2/entries/en/bruh" + 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[0]['word']) + pronouncation = (s[0]['phonetics'][0]['text']) + definition = (s[0]['meanings'][0]['definitions'][0]['definition']) + + msg = f"**Word:** `{name} {pronouncation}`\n\n**Definition:** ```{definition}```" + + bot.run(TOKEN)