Each directory is a complete bot. Set a token and a server id, then run it:
cd basic
DISCORD_TOKEN=... GUILD_ID=... go run .
Commands are registered to that one server, which takes effect immediately; global registration takes about an hour to propagate.
| shows | |
|---|---|
basic |
a slash command, permission gates, a cooldown, dependency injection, graceful shutdown |
autocomplete |
fixed choice lists, suggestions computed as the user types, a select menu |
contextmenu |
one struct serving a slash command and both right click menus |
components |
typed component state, buttons that survive a restart, a modal |
prefix |
one struct serving slash and text, variadic arguments, subcommands, edit tracking |
testing |
commands tested with struttest, no token needed |
testing is the one to run first, since it needs nothing:
cd testing && go test ./...
prefix needs the message content intent, which is privileged: enable it for
the application in the Discord developer portal.