mirror of https://codeberg.org/soteria/sox.git
17 lines
664 B
Python
17 lines
664 B
Python
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() |