Extensions API Reference#
Extensions for adding commands and listeners from other files.
Extension#
- class dawn.Extension(name: str, description: str = 'No Description', *, default_guilds: Optional[List[int]] = None)[source]#
- add_slash_group(group: SlashGroup) None [source]#
Add a slash command group to bot’s bucket.
- Parameters
group (
SlashGroup
) – The group to be added.
- create_setup(bot: Bot) Extension [source]#
Call this method to add the extension to the bot.
- Parameters
bot (
Bot
) – The bot class to add extension to.
- property default_guilds: Optional[List[int]]#
The default guilds for this extension
- listen_for(event: Any) Callable[[Callable[[...], Any]], None] [source]#
Add a listener from the extension.
- Parameters
event (
Event
) – The event to listen for.
- property listeners: Mapping[Any, List[Callable]]#
Listeners in this extension
- register(command: SlashCommand) SlashCommand [source]#
Use this decorator to add a slash command to the bot in an extension.
- Returns
A callable slash command.
- Return type
t.Callable[[], "SlashCommand"]
- property slash_commands: Mapping[str, SlashCommand]#
Slash commands in this extension
- property slash_groups: Mapping[str, SlashGroup]#
Slash groups in this extension