didier/cogs/slash/define_slash.py

20 lines
634 B
Python
Raw Normal View History

from discord.ext import commands
2022-02-03 01:43:54 +01:00
from discord.commands import slash_command, ApplicationContext, Option
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
2022-02-03 01:43:54 +01:00
@slash_command(name="define", description="Urban Dictionary")
async def _define_slash(self, ctx: ApplicationContext, query: Option(str, "Search query", required=True)):
embed = Definition(query).to_embed()
2022-02-03 01:43:54 +01:00
await ctx.respond(embed=embed)
def setup(client: Didier):
client.add_cog(DefineSlash(client))