Monolith DPS is an advanced integration between discord roles and permissions on your FiveM Server with the ESX Framework.
- ๐ Automatic Role Sync: Seamlessly syncs Discord roles to ESX groups
- ๐ Smart Queue System: Handles rate limits with intelligent request queuing
- ๐ก๏ธ Rate Limit Protection: Built-in safeguards against Discord API rate limiting
- ๐ง Highly Configurable: Extensive configuration options for fine-tuning
- ๐ Debug Mode: Detailed logging for troubleshooting (production-friendly)
- โก Performance Optimized: Efficient bulk operations with configurable batching
- ๐จ Error Resilience: Comprehensive error handling with fallback options
- ๐ฏ Priority System: Role hierarchy based on configuration order
- FiveM Server with ESX framework
- Discord Bot with proper permissions
- Discord Guild where roles are managed
- Download or clone this repository
- Extract the files to your
resourcesfolder - Add
ensure monolith-dpsto yourserver.cfg - Configure the
config.luafile (see Configuration section) - Restart your server
Edit config.lua and configure the following essential settings:
Config = {
-- Discord Bot Configuration
botToken = "YOUR_BOT_TOKEN", -- Your Discord bot token
guildId = "YOUR_GUILD_ID", -- Your Discord server ID
-- Role Configuration (ORDER MATTERS!)
roles = {
{ id = "ROLE_ID_1", name = "superadmin" }, -- Highest priority
{ id = "ROLE_ID_2", name = "admin" }, -- Medium priority
{ id = "ROLE_ID_3", name = "moderator" }, -- Lower priority
-- Add more roles as needed
},
}-
Create a Discord Application:
- Go to Discord Developer Portal
- Click "New Application" and give it a name
- Go to "Bot" section and click "Add Bot"
-
Get Your Bot Token:
- In the Bot section, click "Copy" under Token
- Paste this token in
config.luaasbotToken
-
Set Bot Permissions:
- Your bot needs
View Server Memberspermission - Invite the bot to your Discord server with this permission
- Your bot needs
-
Get Guild ID:
- Enable Developer Mode in Discord
- Right-click your server โ "Copy Server ID"
- Paste this in
config.luaasguildId
-
Get Role IDs:
- Right-click any role in your Discord server
- Click "Copy Role ID"
- Add roles to the
rolestable inconfig.lua
IMPORTANT: Role priority is determined by the ORDER in the roles table!
roles = {
{ id = "123456789", name = "superadmin" }, -- ๐ฅ HIGHEST PRIORITY
{ id = "987654321", name = "admin" }, -- ๐ฅ Medium priority
{ id = "456789123", name = "user" }, -- ๐ฅ Lowest priority
}If a player has multiple configured Discord roles, they will receive the first matching role from the list.
Config = {
-- Debug Settings
debugMode = false, -- Enable detailed logging
-- Rate Limiting & Queue Settings
apiCooldown = 1000, -- Delay between API calls (ms)
queueProcessDelay = 100, -- Queue processing delay (ms)
rateLimitRetryDelay = 5000, -- Rate limit retry delay (ms)
-- Bulk Operation Settings
bulkSyncBatchSize = 5, -- Players per batch
bulkSyncDelay = 1000, -- Delay between batches (ms)
-- Fallback Settings
defaultRole = "user", -- Default role assignment
fallbackOnError = true, -- Use default role on errors
}refreshpermissions- Description: Manually refresh permissions for all online players
- Usage: Type in server console to force a permission sync
- Note: Clears the request queue and processes all players fresh
Enable debug mode for detailed logging:
debugMode = trueDebug Mode Shows:
- โ Individual player role assignments
- ๐ Queue status and processing details
- ๐ API request/response information
โ ๏ธ Detailed error messages
Production Mode (debugMode = false):
- โ Clean console output
- โ Only essential error messages
- โ No per-player spam
Solution: Make sure you've replaced YOUR_BOT_TOKEN with your actual Discord bot token.
Solution: Ensure your Discord bot has View Server Members permission in your Discord server.
Solution: Player isn't in your Discord server or has their Discord account disconnected from FiveM.
Solution: The queue system will automatically handle this. If persistent, increase apiCooldown value.
-
Enable Debug Mode:
debugMode = true
-
Check Console Output: Look for colored error messages:
- ๐ด Red: Critical errors
- ๐ก Yellow: Warnings
- ๐ข Green: Success messages
- โช Gray: Debug information
-
Verify Configuration: Restart the resource and check for configuration errors
-
Test Manual Refresh: Use
refreshpermissionscommand in console
If you experience issues with many players:
-- Reduce batch sizes
bulkSyncBatchSize = 3,
manualRefreshBatchSize = 2,
-- Increase delays
apiCooldown = 2000,
bulkSyncDelay = 2000,- NEVER SHARE your Discord bot token
- Store your bot token securely
- Use minimal required Discord permissions
- โ Caching removed for real-time accuracy
- โ Queue system added for rate limit handling
- โ Debug mode added for production-friendly logging
- โ All settings moved to config file
- โ Enhanced error handling and resilience
If you encounter issues:
- Check this README for common solutions
- Enable debug mode and check console output
- Verify your Discord bot setup and permissions
- Test with the manual refresh command
Please refer to the LICENSE.md
Made with โค๏ธ for the FiveM community