Discord Setup & Configuration

Complete guide for setting up Discord integration with LuaBeans - Community Manager.

Overview

LuaBeans integrates with Discord for:

  • User Authentication - Discord OAuth2 login

  • Role Syncing - Automatic role-to-department mapping

  • Bot Commands - Slash commands for management

  • Notifications - Real-time notifications via Discord

Prerequisites

Before setting up Discord integration:

Step 1: Create Discord Application

  1. Click New Application

  2. Name it (e.g., "LuaBeans")

  3. Click Create

Step 2: Configure OAuth2

  1. Navigate to OAuth2General

  2. Add Redirect URI:

  3. Copy Client ID and Client Secret

  4. Save changes

Step 3: Create Bot User

  1. Navigate to Bot in left sidebar

  2. Click Add Bot

  3. Click Yes, do it!

  4. Copy Bot Token

  5. Enable Privileged Gateway Intents:

    • SERVER MEMBERS INTENT

    • MESSAGE CONTENT INTENT

Step 4: Invite Bot to Server

  1. Go to OAuth2URL Generator

  2. Select scopes:

    • bot

    • applications.commands

  3. Select bot permissions:

    • View Channels

    • Send Messages

    • Use Slash Commands

    • Embed Links

    • Attach Files

    • Read Message History

    • Manage Roles (if needed)

  4. Copy generated URL

  5. Open URL and authorize bot

Step 5: Configure Web Panel

In your web panel .env file:

Step 6: Configure RBAC

Link Discord roles to departments:

  1. Go to AdminRBAC in web panel

  2. Pair Discord Guild with system

  3. Map Discord roles to departments

  4. Configure permissions

Step 7: Start Bot

Start the Discord bot:

Or in production:

Verification

Test OAuth2 Login

  1. Go to https://your-domain.com/login

  2. Click "Login with Discord"

  3. Authorize application

  4. Verify redirect works

Test Bot Commands

  1. Type /ping in Discord

  2. Bot should respond with "pong"

  3. Try /verify to test commands

Test Role Syncing

  1. Add Discord role to user

  2. Wait for automatic sync (or use /syncme)

  3. Verify user has department access in web panel

Troubleshooting

OAuth2 Issues

Issue: Cannot login with Discord

Solutions:

  1. Verify DISCORD_CALLBACK_URL matches exactly

  2. Check DISCORD_CLIENT_ID and DISCORD_CLIENT_SECRET are correct

  3. Verify application exists in Discord portal

  4. Check OAuth2 redirect URI is added

Bot Not Responding

Issue: Bot doesn't respond to commands

Solutions:

  1. Check bot is online (green dot)

  2. Verify DISCORD_BOT_TOKEN is correct

  3. Check bot has required permissions

  4. Verify intents are enabled

  5. Restart bot

Role Sync Not Working

Issue: Discord roles not syncing

Solutions:

  1. Verify bot has SERVER MEMBERS INTENT

  2. Check DISCORD_GUILD_ID is correct

  3. Verify RBAC is configured

  4. Use /syncme command to force sync

  5. Check bot has permission to read members

Last updated