#how to make slash command group that also has a slash command with the same name?

1 messages · Page 1 of 1 (latest)

stark swift
#

My code is:

# import lightbulb as lb, bot app created, etc. not relevant to the issue

@bot.command
@lb.command('cmd', 'command group')
@lb.implements(lb.SlashCommandGroup)
async def cmd_():
  pass # You can't execute code within command group right?

@bot.command
@lb.command('cmd', 'commandfasdfds')
@lb.implements(lb.SlashCommand)
async def cmd(ctx: lb.SlashContext):
  await ctx.respond('Running cmd') # Does not work, raises lightbulb.errors.CommandAlreadyExists

@cmd_.child
@lb.command('test', 'commandasdf')
@lb.implements(lb.SlashSubCommand)
async def tasklist(ctx: lb.SlashContext):
  await ctx.respond('Running cmd test')

And i want to make it such that both /cmd and /cmd test would work and call their respective functions without the /cmd having to be named something like /cmd_ to avoid naming collisions, is this possible?

meager blaze
#

discord limitation

sleek basalt
#

it's not possible

#

all of your subcommands need to be at the same level

#

your best alternative is to do something like /cmd base and /cmd test

fading lagoon
#

alternatively this is possible with prefix commands but can be somewhat more fiddly to write

stark swift
#

Okay, thanks for help