Making commands customizable by the guild members
Hello!
I've seen quite a few bots with the option to let guild members create their own custom commands (like YAGPDB and RoleplayTools). I've searched everywhere and in every way I can think of, but Google and the discord.js guide haven't yielded any results accurate to what I'm looking to code into my discord bot.
Is there a way to allow users to create/edit custom slash commands? Or is that only possible using prefix commands?
Thank you to anyone who is able to help!
[Note: I have some experience with discord.js, but I am still learning]
10 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPYou can create guild based commands if that's what you're looking for, here's the guide
They won't be global and will only be in the guild you specify
If you are asking how do these bots execute the command, they probably have a predefined list of functions before hand that corresponds to what the bot will do.
Thank you for responding and explaining! What I'm looking for is a way to allow guild members to create their own slash commands, if that's possible.
That is possible, you can also use <Guild>.commands.create to create the command in the guild, provided the data you provide is sufficient
Like you can ask your members to insert name, description (and any option), then ask them what would the bot like to do, such as send a normal message, send an embed etc
Then use the data to create the slash command, and execute it based on your handler
However do note that a guild can only have a maximum of 100 guild commands
:property: Guild#commands
A manager of the application commands belonging to this guild
:method: ApplicationCommandManager#create()
Creates an application command.
Understood. That makes a lot of sense actually, I'm not sure why I couldn't find that info anywhere online. Maybe I wasn't looking hard enough lol. Thanks so much for the help, it's much appreciated! :)
No problem! However if you do find making slash commands for users troublesome, you can always use message commands, if you have the message intent of course
Got it! :)