Same command files but in different folders
So is sapphire like going to function well if I were for example have kick.js twice but one in admin folder and one in developer folder? Both set to deploy to different guilds?
Solution:Jump to solution
- department/kick.js
-
name: 'department/kick'
- developer/kick.js
- name: 'developer/kick'
...13 Replies
No, whichever is loaded last will remain in the list. To solve this issue, you should use different names for the files or set the
name
option in the constructor.So as long as my file names are like kickDeveloper or kickDepartment, it would work? (with name property being still kick)
The pieces are mapped by
name
And its default is the file name
If you set the file names differently but override the name
property to the same, it'll still treat it as duplicatesSo the only solution would be making one slash command but write each own handling for every guild?
No, slash commands are mapped by the ID, name isn't used
So you can set different names for the two files and it'll just work
such as kickdepartment? I'm sorry I'm just so confused right now
Yes
Wouldn't it look weird though
if the slash command was named this way
unless I am getting something wrong?
It wonβt change a thing in the slash command
Unless youβre setting this.name
Remember, you set the command name
- kickdepartment
- name property set to kick
- kickdeveloperguild
- name property set to kick as well
this is what I want to achieve
I swear my discord formatting even breaks
So if this is possible, It'd be great, if not, I guess I'll just make one global one with individual handling for each.
Sorry, I wasn't able to provide more info, people weren't giving me a breath at work
Solution
- department/kick.js
-
name: 'department/kick'
- developer/kick.js
- name: 'developer/kick'
In both commands, inside registerChatInputCommand
at the registerApplicationCommands
method, do the following:
This will ensure that the slash command is called kick
in both.Alright thank you, I sadly can't check it out right now but will do soon asap!