Skip to content

Add automatic command registration - #640

Open
JstnMcBrd wants to merge 10 commits into
mainfrom
mcb/autoregister
Open

Add automatic command registration#640
JstnMcBrd wants to merge 10 commits into
mainfrom
mcb/autoregister

Conversation

@JstnMcBrd

@JstnMcBrd JstnMcBrd commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Resolves a TODO item. Reviewing commit-by-commit may be easier.


This PR makes it so commands are automatically registered upon startup - no special entrypoint required. Along the way, I made several other improvements.

Efficient

  • Commands are not registered unless they are already out-of-sync
  • Pre-fetch guilds to avoid unnecessary network requests

More correct

  • Deleting all local commands will remove all registered commands now (empty arrays were ignored before)
  • Check more properties of commands (descriptions, type, nsfw, subcommand groups, subcommands, options, etc), not just names
  • Adjusted terminology (deploy -> register)
  • Added uptime worker test for clientReady (previously uncovered)

Simpler

  • No more parseArgs
  • No more package.json command scripts
  • No more revokeCommands (never used in practice)
  • Don't log exact differences between actual vs expected commands, just report whether in-sync
  • Most of the complexity is now isolated to finding comparable values between local and registered commands, while the rest of the process is much simpler
  • Simpler tests (for the most part)

Also added types to some commands - necessary because they are left undefined if not set, making them impossible to compare with registered values.

@JstnMcBrd JstnMcBrd self-assigned this Sep 5, 2026
@JstnMcBrd
JstnMcBrd marked this pull request as ready for review September 5, 2026 09:50
@JstnMcBrd
JstnMcBrd requested a review from a team September 5, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant