Command handler
CommandHandler
#
Handles command building and synchronization for a bot application.
This class is responsible for application commands. It registers commands, synchronizes them with the Discord API.
Attributes:
-
commands(Dict[str, AppCommand]) –Dictionary that stores the AppCommand instances, keyed by their names.
get_command
#
get_command(context: InteractionContext | AutocompleteContext) -> SlashCommand | ContextMenuCommand | SubCommand
Get command from context.
Because sub-commands are passed through the options field of the received interaction,
the arguments for the command have already been processed and are located
in the context.arguments field (InteractionContext.arguments).
sync
async
#
sync(*, debug: bool = False) -> None
Synchronizes the builders of commands with the Discord API for the bot application.
This method will handle both global commands and guild-specific commands.
Parameters:
-
debug(bool, default:False) –A boolean flag that, when set to True, enables more verbose logging of the synchronization process for debugging purposes.