mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 15:48:29 +02:00
Add xkcd command
This commit is contained in:
parent
3c5221f32e
commit
bf272f17c4
5 changed files with 69 additions and 2 deletions
|
|
@ -8,7 +8,7 @@ from functions.timeFormatters import fromString
|
|||
from startup.didier import Didier
|
||||
|
||||
|
||||
class Slash(commands.Cog):
|
||||
class DBSlash(commands.Cog):
|
||||
def __init__(self, client: Didier):
|
||||
self.client: Didier = client
|
||||
|
||||
|
|
@ -84,4 +84,4 @@ class Slash(commands.Cog):
|
|||
|
||||
|
||||
def setup(client: Didier):
|
||||
client.add_cog(Slash(client))
|
||||
client.add_cog(DBSlash(client))
|
||||
|
|
|
|||
29
cogs/slash/fun_slash.py
Normal file
29
cogs/slash/fun_slash.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
from discord.ext import commands
|
||||
from dislash import SlashInteraction, slash_command, Option, OptionType
|
||||
|
||||
from data.embeds.xkcd import XKCDEmbed
|
||||
from startup.didier import Didier
|
||||
|
||||
|
||||
class FunSlash(commands.Cog):
|
||||
def __init__(self, client: Didier):
|
||||
self.client: Didier = client
|
||||
|
||||
@slash_command(
|
||||
name="xkcd",
|
||||
description="Zoek xkcd comics",
|
||||
options=[
|
||||
Option(
|
||||
"num",
|
||||
description="Nummer van de comic (default de comic van vandaag).",
|
||||
type=OptionType.INTEGER,
|
||||
required=False
|
||||
)
|
||||
]
|
||||
)
|
||||
async def _xkcd_slash(self, interaction: SlashInteraction, num: int = None):
|
||||
return await interaction.reply(embed=XKCDEmbed(num).create())
|
||||
|
||||
|
||||
def setup(client: Didier):
|
||||
client.add_cog(FunSlash(client))
|
||||
Loading…
Add table
Add a link
Reference in a new issue