Sync application commands to Discord
Automatic sync (modular / advanced)
Generated modular and advanced bots call syncCommands during startup (see src/sync-commands.*). Behavior:
NODE_ENV | Target | Required env |
|---|---|---|
production | Global application commands | DISCORD_TOKEN, CLIENT_ID |
| Anything else (e.g. development) | Guild application commands | DISCORD_TOKEN, CLIENT_ID, GUILD_ID |
Logs indicate whether commands were synced globally or to a guild.
Manual deploy: forgeloop commands deploy
Use this when you want to push definitions from src/commands without running the bot, or from CI.
npx forgeloop commands deploy
Rules:
--guild— always sync to the guild inGUILD_ID.--global— always sync globally.- Without target flags — same as startup defaults: production -> global, non-production -> guild.
Requirements:
- Modular or advanced project (command modules on disk).
- Env:
DISCORD_TOKEN,CLIENT_ID, andGUILD_IDwhenever the target is guild (including default dev behavior). - TypeScript projects: deploy runs Node with
tsxto import.tscommand files — ensure dev dependencies are installed.
Timeout: 20 seconds per Discord API request; failures include Discord’s error message when JSON is returned.
Related command reference: forgeloop commands.