Discord Setup
Discord Developer Portal configuration for bot token, OAuth, and invite URL.
Step-by-step guide to create a Discord application and configure it for AttendiBot. Use the same application for the bot token, slash commands, and dashboard OAuth.
1. Create a Discord application
- Go to the Discord Developer Portal
- Sign in with your Discord account
- Click New Application
- Enter a name (e.g.
AttendiBot) and click Create - Note the Application ID — this is your OAuth client ID
2. Create a bot user
- In your application, go to Bot (left sidebar)
- Click Add Bot → Yes, do it!
- Under Token, click Reset Token → Yes, do it!
- Copy the token — this is your
DISCORD_TOKEN
Security: Never share your bot token. If it leaks, reset it immediately on the Bot page.
3. Configure bot settings
On the Bot page:
| Setting | Recommended | Why |
|---|---|---|
| Public Bot | Off | Prevents unauthorized installs |
| Requires OAuth2 Code Grant | Off | Not needed for bot tokens |
| Presence Intent | Off | AttendiBot does not track presence |
| Server Members Intent | Off | Not required for voice tracking |
| Message Content Intent | Off | AttendiBot uses slash commands only |
Required gateway intent
AttendiBot requires Guild Voice States (non-privileged). Enable it under Bot → Privileged Gateway Intents if your library requires explicit declaration — Serenity requests this intent automatically.
No privileged intents (Presence, Server Members, Message Content) are required.
4. Configure OAuth2 for the dashboard
- Go to OAuth2 → General
- Add a redirect URI:
For local development:https://attendibot.com/api/auth/callback/discordhttp://localhost:3000/api/auth/callback/discord - Note the Client Secret under OAuth2 — this is
AUTH_DISCORD_SECRETfor the web app
5. Generate bot invite URL
- Go to OAuth2 → URL Generator
- Under Scopes, select:
botapplications.commands
- Under Bot Permissions, select:
- View Channels
- Connect
- Send Messages
- Embed Links
- Use Slash Commands
- Copy the generated URL
Set this as NEXT_PUBLIC_DISCORD_INVITE_URL in the web app environment, or use NEXT_PUBLIC_DISCORD_CLIENT_ID / AUTH_DISCORD_ID to generate it at runtime.
6. Set environment variables
Backend (backend/.env)
DISCORD_TOKEN=your-bot-token-from-step-2
API_INTERNAL_SECRET=generate-a-strong-random-secretOptional for development:
DISCORD_GUILD_ID=your-dev-server-idTo get a server ID: enable Developer Mode in Discord settings → right-click your server → Copy Server ID.
When DISCORD_GUILD_ID is set, slash commands register instantly in that guild. Without it, commands register globally (can take up to 1 hour).
Web (web/.env.local)
AUTH_SECRET=generate-with-openssl-rand-base64-32
AUTH_DISCORD_ID=your-application-id
AUTH_DISCORD_SECRET=your-oauth-client-secret
ATTENDIBOT_API_BASE_URL=http://localhost:8080
ATTENDIBOT_API_INTERNAL_SECRET=same-as-backend-API_INTERNAL_SECRET
NEXT_PUBLIC_SITE_URL=http://localhost:3000
NEXT_PUBLIC_DISCORD_INVITE_URL=your-invite-url-from-step-5Generate AUTH_SECRET:
openssl rand -base64 327. Start AttendiBot
Backend:
cd backend
docker compose up db -d
cargo run -p attendibot-botWeb:
cd web
npm install
npm run devSlash commands register automatically when the bot starts. You should see the bot online in Discord.
Troubleshooting
"An invalid token was provided"
- Copy the full bot token with no extra spaces or quotes
- If you reset the token, update
.envand restart the bot
Commands not appearing
- Wait up to 1 hour for global registration, or set
DISCORD_GUILD_IDfor instant guild registration - Re-invite the bot with the
applications.commandsscope - Restart the bot after changing
DISCORD_GUILD_ID
"Missing Access" or "Missing Permissions"
- Re-invite the bot with correct permissions (Step 5)
- Check channel permission overrides that may block the bot
- Ensure the bot role can view and connect to voice channels
OAuth sign-in fails
- Verify the redirect URI matches exactly:
{SITE_URL}/api/auth/callback/discord - Confirm
AUTH_DISCORD_IDandAUTH_DISCORD_SECRETmatch the Developer Portal
Bot cannot detect voice events
- Confirm the bot has Connect permission in tracked voice channels
- Check tracking mode is not Off and channels are configured correctly
- Verify signing is unlocked (
/admin signing-status)
Next steps
- Getting Started — configure your server after invite
- Deployment — production setup
- Troubleshooting — more issue resolution