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
Go to Discord Developer Portal
Click New Application
Name it (e.g., "LuaBeans")
Click Create
Step 2: Configure OAuth2
Navigate to OAuth2 → General
Add Redirect URI:
Copy Client ID and Client Secret
Save changes
Step 3: Create Bot User
Navigate to Bot in left sidebar
Click Add Bot
Click Yes, do it!
Copy Bot Token
Enable Privileged Gateway Intents:
✅ SERVER MEMBERS INTENT
✅ MESSAGE CONTENT INTENT
Step 4: Invite Bot to Server
Go to OAuth2 → URL Generator
Select scopes:
✅
bot✅
applications.commands
Select bot permissions:
✅ View Channels
✅ Send Messages
✅ Use Slash Commands
✅ Embed Links
✅ Attach Files
✅ Read Message History
✅ Manage Roles (if needed)
Copy generated URL
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:
Go to Admin → RBAC in web panel
Pair Discord Guild with system
Map Discord roles to departments
Configure permissions
Step 7: Start Bot
Start the Discord bot:
Or in production:
Verification
Test OAuth2 Login
Go to
https://your-domain.com/loginClick "Login with Discord"
Authorize application
Verify redirect works
Test Bot Commands
Type
/pingin DiscordBot should respond with "pong"
Try
/verifyto test commands
Test Role Syncing
Add Discord role to user
Wait for automatic sync (or use
/syncme)Verify user has department access in web panel
Troubleshooting
OAuth2 Issues
Issue: Cannot login with Discord
Solutions:
Verify
DISCORD_CALLBACK_URLmatches exactlyCheck
DISCORD_CLIENT_IDandDISCORD_CLIENT_SECRETare correctVerify application exists in Discord portal
Check OAuth2 redirect URI is added
Bot Not Responding
Issue: Bot doesn't respond to commands
Solutions:
Check bot is online (green dot)
Verify
DISCORD_BOT_TOKENis correctCheck bot has required permissions
Verify intents are enabled
Restart bot
Role Sync Not Working
Issue: Discord roles not syncing
Solutions:
Verify bot has SERVER MEMBERS INTENT
Check
DISCORD_GUILD_IDis correctVerify RBAC is configured
Use
/syncmecommand to force syncCheck bot has permission to read members
Related Documentation
Discord Bot Setup - Complete bot setup guide
Discord Bot Commands - All available commands
RBAC System - Role-based access control
Last updated
