from typing import Optional import asyncio import discord from discord.ext import commands as cmds from discord import app_commands as appcmds from meta import LionBot, LionCog, LionContext from meta.errors import ResponseTimedOut, SafeCancellation, UserInputError from . import logger from ..data import QuotesData from ..quotes import QuoteRegistry class QuoteCog(LionCog): def __init__(self, bot: LionBot): self.data = bot.db.load_registry(QuotesData()) self.quotes = QuoteRegistry(self.data) async def cog_load(self): await self.data.init() await self.quotes.init() # ----- API ----- async def quote_acmpl(self, interaction: discord.Interaction, partial: str): # TODO ... # ----- Commands ------ @cmds.hybrid_command( name='quote', description="Display a random quote." ) async def quote_cmd(self, ctx: LionContext): # TODO ... @cmds.hybrid_group( name='quotes', description="Base command group for quotes management.", ) async def quotes_grp(self, ctx: LionContext): # TODO # Call the quotes list command ... @cmds.hybrid_command( name='addquote', description="Create a new quote. Use without arguments to add a multiline quote." ) @quotes_grp.command( name='add', description="Create a new quote. Use without arguments to add a multiline quote." ) @appcmds.describe( content="Content of the quote to add" ) async def quotes_add_cmd(self, ctx: LionContext, content: Optional[str]): # TODO ... @quotes_grp.command( name='del', description="Delete a saved quote (WARNING: This will change all quote numbers.)" ) @appcmds.describe( quote="Select the quote to delete, or write the number." ) async def quotes_del_cmd(self, ctx: LionContext, quote: str): # TODO ... @quotes_grp.command( name='list', description="Display the community quotes. Quotes may also be added/edited/deleted here." ) async def quotes_list_cmd(self, ctx: LionContext): # TODO ... @quotes_grp.command( name='edit', description="Edit a saved quote." ) @appcmds.describe( quote="Select the quote to delete, or write the number." ) async def quotes_edit_cmd(self, ctx: LionContext, quote: str): # TODO: Move quote to QuoteConverter? # TODO ...