mirror of https://codeberg.org/soteria/sox.git
feat: joke command
This commit is contained in:
parent
08740c8df9
commit
86dba83c34
|
|
@ -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()
|
||||||
Loading…
Reference in New Issue