Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

fix: correct usage for deploying commands #421

Merged

Conversation

miscfrizzy
Copy link
Contributor

DiscordJS documentation incorrectly tells people to use the "PUT" call, which is okay if the discord bot runs in isolation. However, Discord's API Commands "PUT" call will replace ALL commands that have been registered. Commands should be updated individually so as to not erase existing commands that are registered to the bot.

Changes

Changes the deploySlashCommands.ts discord API call to asynchronously call discordJS's "rest.post" call for each command rather than using the "rest.put" for the entire set of commands. This way we don't erase commands added to the job from other bot applications running under the same token.

DiscordJS documentation incorrectly tells people to use the "PUT" call. Discord's API "PUT" call will replace ALL commands that have been registered. Commands should be updated individually so as to not erase existing commands that are regisitered to the bot.
@mariusbegby
Copy link
Owner

lgtm!

@mariusbegby mariusbegby merged commit 0164af9 into mariusbegby:main Apr 21, 2024
3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants