You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Throws CommandRegistrationError when trying to create a guild & a global slash command having same name.
To Reproduce
Create a guild & a global slash command with same name.
final globalSlash =ChatCommand(
'slash', // Same name as "guildSlash"'placeholder',
id(...)
);
final guildSlash =ChatCommand(
'slash', // Same name as "globalSlash"'placeholder',
singleChecks: [GuildCheck.id(...)],
id(...)
);
Add them in your client's CommandsPlugin().
final commands =CommandsPlugin(...)
..addCommand(globalSlash)
..addCommand(guildSlash);
Run the bot & you'll get this error.
Command with name "slash" already exists
Expected behavior
Perform the below curl command & then, check your bot slash commands. You'll see 2 slash commands having same name slash. Here, one is guild & the other one is global. This is what we want i.e to create guild & global slash commands with same name in nyxx_commands.
Just had a look at this, and it's more complicated that it might first seem.
These are the two big issues:
A command isn't necessarily bound to a single guild. It can be bound to multiple (GuildCheck.anyId([1, 2, 3])), which can then lead to overlaps with other commands: command A with guilds 1, 2 and 3 conflicts with command B with guild 2. This complicates the detection algorithm quite a bit.
When using text commands, it's unclear whether !test in guild 1 should run the global !test or the guild !test.
I think the best solution would be to disallow this. It is supported by Discord, but I don't think it's great for UX and it's ambiguous how nyxx_commands should handle it.
Describe the bug
Throws
CommandRegistrationError
when trying to create a guild & a global slash command having same name.To Reproduce
CommandsPlugin()
.Expected behavior
Perform the below
curl
command & then, check your bot slash commands. You'll see 2 slash commands having same nameslash
. Here, one is guild & the other one is global. This is what we want i.e to create guild & global slash commands with same name innyxx_commands
.Important
When performing the above request, do replace
BOT_ID
,GUILD_ID
&TOKEN
with actual values.Desktop:
dev
branch)main
branch)The text was updated successfully, but these errors were encountered: