didier/cogs/slash/fun_slash.py

21 lines
708 B
Python
Raw Normal View History

2022-01-16 19:55:07 +01:00
from discord.ext import commands
2022-02-03 01:43:54 +01:00
from discord.commands import slash_command, ApplicationContext, Option
2022-01-16 19:55:07 +01:00
from data.embeds.xkcd import XKCDEmbed
from startup.didier import Didier
class FunSlash(commands.Cog):
def __init__(self, client: Didier):
self.client: Didier = client
2022-02-03 01:43:54 +01:00
@slash_command(name="xkcd", description="Zoek xkcd comics")
async def _xkcd_slash(self, ctx: ApplicationContext,
num: Option(int, description="Nummer van de comic (default de comic van vandaag).", required=False, default=None)
):
return await ctx.respond(embed=XKCDEmbed(num).create())
2022-01-16 19:55:07 +01:00
def setup(client: Didier):
client.add_cog(FunSlash(client))