Enhance command registration process and improve guild command handling

- Introduced a new `buildCommandBody` function to prevent duplicate command definitions during registration.
- Implemented `clearGuildCommandLeftovers` to remove unused guild-scoped commands, ensuring a clean command picker in Discord.
- Updated command registration logic to clear global commands when using guild-specific commands, improving command visibility and user experience.
- Enhanced logging to provide clearer insights into command registration and cleanup processes.
This commit is contained in:
smueller
2026-07-23 10:24:47 +02:00
parent 629e89f380
commit 4b6736444c
2 changed files with 58 additions and 10 deletions

View File

@@ -4,6 +4,10 @@ NODE_ENV=production
BOT_TOKEN=
BOT_CLIENT_ID=
BOT_CLIENT_SECRET=
# Optional: register slash commands only on this guild (instant sync for dev).
# Leave empty in production so commands are global. When set, global commands
# are cleared; when empty, leftover guild-scoped commands are cleared on startup
# so Discord does not show every command twice.
BOT_GUILD_ID=
DATABASE_URL=postgresql://nexumi:nexumi@postgres:5432/nexumi
REDIS_URL=redis://redis:6379