How to publish guild specific commands while having global commands

I have two folders for two categories of commands. One folder named "commands" for global commands and one folder named "guildCommands" for commands that is for only some guilds.
37 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
MrMythical
MrMythical3y ago
do separate rest requests
Febkosq8
Febkosq8OP3y ago
Febkosq8
Febkosq8OP3y ago
MrMythical
MrMythical3y ago
rest.put(Routes.applicationCommands(clientId), { body }) and rest.put(Routes.applicationGuildCommands(clientId, guildId), { body })
Febkosq8
Febkosq8OP3y ago
MrMythical
MrMythical3y ago
pass the commands you want for each in the body
Febkosq8
Febkosq8OP3y ago
i dont think i am using rest for my implementation
MrMythical
MrMythical3y ago
why 🤔 you should
d.js docs
d.js docs3y ago
guide Creating Your Bot: Registering commands - Command deployment script read more
Febkosq8
Febkosq8OP3y ago
the tutorial i started showed me like this
MrMythical
MrMythical3y ago
well don't follow that use discordjs.guide it's maintained by discord.js developers and the community, and kept updated
Febkosq8
Febkosq8OP3y ago
ok could you let me know what i am using rn over here await client.application.commands.set(client.commands);
MrMythical
MrMythical3y ago
you are using client.application which requires the bot to be logged in this is not good practice
Febkosq8
Febkosq8OP3y ago
ohh so on reading that guide i had few doubt once i create my deploy-commands.js how do i make it run automatically when my bot is added to a new server
MrMythical
MrMythical3y ago
what why
Febkosq8
Febkosq8OP3y ago
let me rephrase
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
MrMythical
MrMythical3y ago
which requires the bot to be logged in
this also usually comes with setting in ready event
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Febkosq8
Febkosq8OP3y ago
MrMythical
MrMythical3y ago
no that's terrible
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
MrMythical
MrMythical3y ago
setting in ready event is not needed
Febkosq8
Febkosq8OP3y ago
what if the bot joins a server after that was run
MrMythical
MrMythical3y ago
you only need to deploy when commands are updated then they have the global commands
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
MrMythical
MrMythical3y ago
why just use rest doesn't even need the client logged in
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Febkosq8
Febkosq8OP3y ago
here it says change applicationGuildCommands to applicationCommands but i still need to run it myself right
Febkosq8
Febkosq8OP3y ago
so will the new server automatically get it ?
MrMythical
MrMythical3y ago
yes the new server will get the global commands
Febkosq8
Febkosq8OP3y ago
ok thanks will try and update
MrMythical
MrMythical3y ago
👍
Febkosq8
Febkosq8OP3y ago
Febkosq8
Febkosq8OP3y ago
i need to import my set of commands into this. how can i make it take the details from each file and auto create the set of commands. edit: done. found a method
d.js docs
d.js docs3y ago
guide Interactions: Replying to slash commands - Receiving interactions read more
Want results from more Discord servers?
Add your server