SlashGroup
Class
Command group: /group subcommand or /group subgroup subcommand.
from discord_interactions import SlashGroupConstructor
SlashGroup( name: str, description: str, commands: Dict[str, SlashCommand] = <factory>, subgroups: Dict[str, SlashGroup] = <factory>, name_localizations: Dict[str, str] | None = None, description_localizations: Dict[str, str] | None = None, guild_ids: Set[int] | None = None, permissions: PermissionConfig = <factory>,)| Name | Type | Default | Description |
|---|---|---|---|
name | str | required | |
description | str | required | |
commands | Dict[str, SlashCommand] | <factory> | |
subgroups | Dict[str, SlashGroup] | <factory> | |
name_localizations | Dict[str, str] | None | None | |
description_localizations | Dict[str, str] | None | None | |
guild_ids | Set[int] | None | None | |
permissions | PermissionConfig | <factory> |
Properties
| Name | Type | Description |
|---|---|---|
name | str | |
description | str | |
commands | Dict[str, SlashCommand] | |
subgroups | Dict[str, SlashGroup] | |
name_localizations | Dict[str, str] | None | |
description_localizations | Dict[str, str] | None | |
guild_ids | Set[int] | None | |
permissions | PermissionConfig |
Methods
command
def command( name: str | None = None, description: str = 'No description', *, options: List[OptionBase] | None = None, **kwargs: Any,) -> Callable[[~T], ~T]Decorator: adds a subcommand.
subgroup
def subgroup( name: str, description: str = 'No description', **kwargs: Any,) -> SlashGroupCreates a subgroup.
find
def find( raw_options: List[Dict[str, Any]],) -> Tuple[SlashCommand | None, List[Dict[str, Any]]]to_dict
def to_dict() -> Dict[str, Any]Example
config = slash.group("config", "Configuration")salons = config.subgroup("salons", "Salons du bot") @salons.command(description="Salon des logs")@option(Channel("salon", "Salon"))async def logs(ctx, salon): await ctx.respond(f"Logs : {salon.mention}")