#Duplicated Slash Commands
1 messages · Page 1 of 1 (latest)
Situation 1
Command not showing (base and subcommand)
@slash_command(
name='char',
scopes=[1234567890],
)
async def char(
ctx,
):
pass
@char.subcommand(
sub_cmd_name='show',
sub_cmd_description='Show information of a character'
)
@slash_option(
name="character_id",
required=False,
opt_type=OptionType.INTEGER,
)
async def show(
ctx,
character_id: int = 0,
):
pass
@char.subcommand(
sub_cmd_name='create',
sub_cmd_description='Create a new character'
)
@slash_option(
name="character",
required=True,
opt_type=OptionType.STRING,
max_length=24
)
@slash_option(
name="character_name",
required=False,
opt_type=OptionType.STRING,
min_length=3,
max_length=24
)
async def create(
ctx,
character: str,
character_name: str = "",
):
pass
@char.subcommand(
sub_cmd_name='delete',
sub_cmd_description='Delete a character',
)
@slash_option(
name="character_id",
required=True,
opt_type=OptionType.INTEGER,
)
async def delete(
ctx,
character_id: int,
):
pass
Here I can only see the 2 subcommands "create" and "delete". I changed the functions to "pass" just to make it easier to read, but they contain actual code.
Situation 2
Base command won't show. 1 subcommand is normal, the other 2 are dupes.
@slash_command(
name='team',
scopes=[1234567890],
)
async def team(
ctx
):
pass
@team.subcommand(
sub_cmd_name='show',
sub_cmd_description='Show your active team'
)
async def show(
ctx,
):
try:
pass
@team.subcommand(
sub_cmd_name='add',
sub_cmd_description='Add a character to your team'
)
@slash_option(
name="character_id",
required=True,
opt_type=OptionType.INTEGER,
)
async def add(
ctx,
character_id: int
):
pass
@team.subcommand(
sub_cmd_name='remove',
sub_cmd_description='Remove a character from your team'
)
@slash_option(
name="character_id",
required=True,
opt_type=OptionType.INTEGER,
)
async def remove(
ctx,
character_id: int
):
pass
I thought it could be some caching problem, so I turn the bot off overnight. Deleted pycache as well.
Update:
Commenting/uncommenting the char command made the subcommand "/char show" appear. The basic command doesnt show up tho.
Commenting all /team commands and subcommands, but 2 sub commands still appear on discord. Not sure where is the caching :c
by default, we only synchronise commands we detect existing modified changes to. if you want to delete unused commands, you'll need to pass delete_unused_application_cmds=True in your Client() declaration
for reference, here's our documentation for it
found this on another ticket. Problem WAS caching.