#Multiple subcommands per cog

1 messages · Page 1 of 1 (latest)

left bolt
#

How do I get multiple subcommands per cog? it appears as if the last subcommand overwrites all the others.

In the following example, only the math add-3-3 command is registered. If I remove the add, only the math multiply-3-3 command is registered. If I remove both subcommands, the math command is registered but the subcommands aren't.

@slash_command(
        name="math",
        description="Does Math"
    )
    async def add(self, ctx: InteractionContext):
        await ctx.send(f"TODO\nYou passed {user} as your option!", ephemeral=True)

@add.subcommand(
        sub_cmd_name="multiply-3-3",
        sub_cmd_description="Multiplies 3"
    )
    async def add(self, ctx: InteractionContext):
        await ctx.send("3*3 = 9")

@add.subcommand(
        sub_cmd_name="add-3-3",
        sub_cmd_description="Adds 3"
    )
    async def add(self, ctx: InteractionContext):
        await ctx.send("3+3 = 6")
fringe plank
#

all your methods are called add, so youre overriding the previous method with the next one

#

use unique names for your methods

left bolt
#

Ohhhhhhhh

left bolt