Deploy Discord commands during bot build #198
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I talked with Nick about this a little bit a few weeks ago, #148 looked like it hit a wall due to how weirdly different slash commands are from responding to messages. There's still a larger change we could make for performance reasons if we need it (we won't need it) where we could set up a web server, and configure Discord to emit web hooks for commands instead of using a persistent network connection.
The meat of this change is in
scripts/deploy-commands.ts
, which fetches the commands and compares the remote list with its local list. This requires that we update the deployment script for every new command we add, but that should be a pretty small amount — command arguments allow us to do most things we are currently, so for example we can do 1 command instead of like 15 for our saved responses.A follow up task that should probably be done but will work for now is, these are "guild commands", not "global commands". Guild commands update immediately but are presumably worse for performance — I think that because this is a "pet bot" and not used generically in dozens of servers, we won't feel any pain because of that.