diff --git a/plugins/fun.py b/plugins/fun.py new file mode 100644 index 0000000..d607747 --- /dev/null +++ b/plugins/fun.py @@ -0,0 +1,17 @@ +from disnake.ext import plugins + +import disnake +import aiohttp + +plugin = plugins.Plugin() + +@plugin.slash_command() +async def joke(inter: disnake.CommandInteraction): + async with aiohttp.ClientSession() as cs: + async with cs.get("https://v2.jokeapi.dev/joke/Programming,Miscellaneous?blacklistFlags=nsfw,political&type=single") as resp: + resp = await resp.json() + em = disnake.Embed(title="A joke for you!", description=resp["joke"], color=disnake.Color.random()) + em.set_footer(text="powered by v2.jokeapi.dev") + await inter.response.send_message(embed=em) + +setup, teardown = plugin.create_extension_handlers() \ No newline at end of file