Skip to content

command-handling: index.js vs deploy-commands.js #1017

Answered by BenjammingKirby
Sckorpeo asked this question in Q&A
Discussion options

You must be logged in to vote

deploy-commands.js registers the commands, it sends an api request to register whereas in index.js if you've followed the guide, it just reads your local files and stores them in a collection for future use

these two are very different and the reason why we don't register in index.js and use a separate script is to separate the register process from the bot process, think about it, if we were to register using index.js, the file that gets ran every time the bot turns on, we'd be sending needless api requests to register the commands that haven't even changed
to avoid that and to make sure that you only send the request when you have changes and want to update the commands, the deploy-comm…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@Sckorpeo
Comment options

@BenjammingKirby
Comment options

@Sckorpeo
Comment options

@BenjammingKirby
Comment options

@Sckorpeo
Comment options

Answer selected by Sckorpeo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants