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:
- department/kick.js - name: 'department/kick' - developer/kick.js - name: 'developer/kick' ...
Jump to solution
13 Replies
kyra
kyraβ€’3mo ago
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.
Shrewd πŸ’«
Shrewd πŸ’«OPβ€’3mo ago
So as long as my file names are like kickDeveloper or kickDepartment, it would work? (with name property being still kick)
kyra
kyraβ€’3mo ago
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 duplicates
Shrewd πŸ’«
Shrewd πŸ’«OPβ€’3mo ago
So the only solution would be making one slash command but write each own handling for every guild?
kyra
kyraβ€’3mo ago
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
Shrewd πŸ’«
Shrewd πŸ’«OPβ€’3mo ago
such as kickdepartment? I'm sorry I'm just so confused right now
kyra
kyraβ€’3mo ago
Yes
Shrewd πŸ’«
Shrewd πŸ’«OPβ€’3mo ago
Wouldn't it look weird though if the slash command was named this way unless I am getting something wrong?
kyra
kyraβ€’3mo ago
It won’t change a thing in the slash command Unless you’re setting this.name Remember, you set the command name
Shrewd πŸ’«
Shrewd πŸ’«OPβ€’3mo ago
- 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.
kyra
kyraβ€’3mo ago
Sorry, I wasn't able to provide more info, people weren't giving me a breath at work
Solution
kyra
kyraβ€’3mo ago
- department/kick.js - name: 'department/kick' - developer/kick.js - name: 'developer/kick' In both commands, inside registerChatInputCommand at the registerApplicationCommands method, do the following:
builder.setName('kick')
builder.setName('kick')
This will ensure that the slash command is called kick in both.
Shrewd πŸ’«
Shrewd πŸ’«OPβ€’3mo ago
Alright thank you, I sadly can't check it out right now but will do soon asap!
Want results from more Discord servers?
Add your server