AttendiBotAttendiBot

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

  1. Go to the Discord Developer Portal
  2. Sign in with your Discord account
  3. Click New Application
  4. Enter a name (e.g. AttendiBot) and click Create
  5. Note the Application ID — this is your OAuth client ID

2. Create a bot user

  1. In your application, go to Bot (left sidebar)
  2. Click Add BotYes, do it!
  3. Under Token, click Reset TokenYes, do it!
  4. 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:

SettingRecommendedWhy
Public BotOffPrevents unauthorized installs
Requires OAuth2 Code GrantOffNot needed for bot tokens
Presence IntentOffAttendiBot does not track presence
Server Members IntentOffNot required for voice tracking
Message Content IntentOffAttendiBot 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

  1. Go to OAuth2General
  2. Add a redirect URI:
    https://attendibot.com/api/auth/callback/discord
    For local development:
    http://localhost:3000/api/auth/callback/discord
  3. Note the Client Secret under OAuth2 — this is AUTH_DISCORD_SECRET for the web app

5. Generate bot invite URL

  1. Go to OAuth2URL Generator
  2. Under Scopes, select:
    • bot
    • applications.commands
  3. Under Bot Permissions, select:
    • View Channels
    • Connect
    • Send Messages
    • Embed Links
    • Use Slash Commands
  4. 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-secret

Optional for development:

DISCORD_GUILD_ID=your-dev-server-id

To 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-5

Generate AUTH_SECRET:

openssl rand -base64 32

7. Start AttendiBot

Backend:

cd backend
docker compose up db -d
cargo run -p attendibot-bot

Web:

cd web
npm install
npm run dev

Slash 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 .env and restart the bot

Commands not appearing

  • Wait up to 1 hour for global registration, or set DISCORD_GUILD_ID for instant guild registration
  • Re-invite the bot with the applications.commands scope
  • 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_ID and AUTH_DISCORD_SECRET match 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

Edit on GitHub

On this page