discord_slash.cog_ext module

discord_slash.cog_ext.cog_slash(*, name: Optional[str] = None, description: Optional[str] = None, guild_ids: Optional[List[int]] = None, options: Optional[List[dict]] = None, default_permission: bool = True, permissions: Optional[Dict[int, list]] = None, connector: Optional[dict] = None)

Decorator for Cog to add slash command.

Almost same as client.SlashCommand.slash().

Example:

class ExampleCog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @cog_ext.cog_slash(name="ping")
    async def ping(self, ctx: SlashContext):
        await ctx.send(content="Pong!")
Parameters
  • name (str) – Name of the slash command. Default name of the coroutine.

  • description (str) – Description of the slash command. Default None.

  • guild_ids (List[int]) – List of Guild ID of where the command will be used. Default None, which will be global command.

  • options (List[dict]) – Options of the slash command. This will affect auto_convert and command data at Discord API. Default None.

  • default_permission (bool) – Sets if users have permission to run slash command by default, when no permissions are set. Default True.

  • permissions (dict) – Dictionary of permissions of the slash command. Key being target guild_id and value being a list of permissions to apply. Default None.

  • connector (dict) – Kwargs connector for the command. Default None.

discord_slash.cog_ext.cog_subcommand(*, base, subcommand_group=None, name=None, description: Optional[str] = None, base_description: Optional[str] = None, base_desc: Optional[str] = None, base_default_permission: bool = True, base_permissions: Optional[Dict[int, list]] = None, subcommand_group_description: Optional[str] = None, sub_group_desc: Optional[str] = None, guild_ids: Optional[List[int]] = None, options: Optional[List[dict]] = None, connector: Optional[dict] = None)

Decorator for Cog to add subcommand.

Almost same as client.SlashCommand.subcommand().

Example:

class ExampleCog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @cog_ext.cog_subcommand(base="group", name="say")
    async def group_say(self, ctx: SlashContext, text: str):
        await ctx.send(content=text)
Parameters
  • base (str) – Name of the base command.

  • subcommand_group (str) – Name of the subcommand group, if any. Default None which represents there is no sub group.

  • name (str) – Name of the subcommand. Default name of the coroutine.

  • description (str) – Description of the subcommand. Default None.

  • base_description (str) – Description of the base command. Default None.

  • base_desc – Alias of base_description.

  • base_default_permission (bool) – Sets if users have permission to run slash command by default, when no permissions are set. Default True.

  • base_permissions (dict) – Dictionary of permissions of the slash command. Key being target guild_id and value being a list of permissions to apply. Default None.

  • subcommand_group_description (str) – Description of the subcommand_group. Default None.

  • sub_group_desc – Alias of subcommand_group_description.

  • guild_ids (List[int]) – List of guild ID of where the command will be used. Default None, which will be global command.

  • options (List[dict]) – Options of the subcommand. This will affect auto_convert and command data at Discord API. Default None.

  • connector (dict) – Kwargs connector for the command. Default None.