Documentation
¶
Overview ¶
This example synchronizes the application (slash) commands declared in this file with Discord using ApplicationCommandsSync. Unlike ApplicationCommandBulkOverwrite (a single PUT that counts against the daily application-command limits and resets command permissions), the sync compares the desired commands with the registered ones by normalized content and issues only the minimum number of REST calls: one POST per new command, one PATCH per changed command and, when asked, one DELETE per removed command. Unchanged commands are never re-sent.
Usage:
DISCORD_TOKEN=... DISCORD_APP_ID=... go run . # apply DISCORD_TOKEN=... DISCORD_APP_ID=... DRY_RUN=1 go run . # plan only go run . -token ... -app ... -guild <id> # guild-scoped go run . -delete-removed # also delete removed commands
The gateway is never opened: the sync is pure REST.