mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 15:48:29 +02:00
Clean up define, create define slash command
This commit is contained in:
parent
c47f908e57
commit
358f8693dd
3 changed files with 142 additions and 91 deletions
25
cogs/slash/define_slash.py
Normal file
25
cogs/slash/define_slash.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
from discord.ext import commands
|
||||
from dislash import SlashInteraction, slash_command, Option, OptionType
|
||||
|
||||
from data.embeds.urban_dictionary import Definition
|
||||
from startup.didier import Didier
|
||||
|
||||
|
||||
class DefineSlash(commands.Cog):
|
||||
def __init__(self, client: Didier):
|
||||
self.client: Didier = client
|
||||
|
||||
@slash_command(name="define",
|
||||
description="Urban Dictionary",
|
||||
options=[
|
||||
Option("query", "Search query", OptionType.STRING, required=True)
|
||||
],
|
||||
guild_ids=[728361030404538488, 880175869841277008]
|
||||
)
|
||||
async def _define_slash(self, interaction: SlashInteraction, query):
|
||||
embed = Definition(query).to_embed()
|
||||
await interaction.reply(embed=embed)
|
||||
|
||||
|
||||
def setup(client: Didier):
|
||||
client.add_cog(DefineSlash(client))
|
||||
Loading…
Add table
Add a link
Reference in a new issue