Discord Bot¶
EasyAdmin 6.6 ships with a Discord bot that allows admins to manage their server entirely from Discord.
Features¶
The Discord bot ships within EasyAdmin and does not need an external host to run on, this is beneficial for people running a containerized FiveM server, or are renting a server with ZAP-Hosting, as these can simply use the bot within their FiveM server.
The current feature set includes:
- Most user actions (kick, (un)ban, mute, freeze, slap, warn)
- Ability to add and remove principals, allowing discord users to be added to ACE groups on discord, without having to join or edit the server.
- A live server status, with player count infos, admins online, open&claimed reports, active entities, amount of upvotes assigned to the server and uptime
- Area cleanup for vehicles, peds and objects
- A player list with pagination (fully onesync compatible)
- A player info display (including identifiers)
- A Discord ACE Perms implementation.
Creating the bot user¶
To create a bot user, we will head over to Discord Developer Apps and create a new application as shown here:
The Bot requires all Privileged Gateway Intents to be enabled, having these disabled will cause the bot to fail to start and trigger a
Privileged intent provided is not enabled or whitelisted
error.
Inviting the bot¶
If you are getting 401 errors, kick the Bot and invite it again using this link.
To invite the bot to your Discord server, copy the following link:
1 |
|
Replace MY_BOT_ID
with your bot's application id from here:
Then simply open the link and invite the bot to your discord server!
Configuring the Bot¶
To actually have EasyAdmin log into the bot, we need to configure the following convars in your server config file:
1 |
|
Fill out your bot token you got from the discord developer page.
Now simply start EasyAdmin, if everything went correctly you should see:
1 |
|
Message appear in your console and the bot should show as "online" on your discord server.
The owner of the Discord server will automatically have all permissions to the bot, for other admins these need to be assigned manually (
easyadmin.bot
)
To test if the bot is working properly, you can run /playerlist
, the output should look something like this:
Configuring permissions¶
Unlike the EasyAdmin GUI, the bot permissions are all contained within the easyadmin.bot
category, this allows restricting groups to have to do actions on the server, instead of using discord, where exact actions may not be reproducable due to changing usernames.
A list of current permissions is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
For default permissions for normal admins, which are not meant to change permissions, we recommend the following preset:
1 2 3 4 5 6 7 8 |
|
Configuring features¶
Discord ACE Permissions¶
EasyAdmin's Discord bot seamlessly integrates Discord roles into FiveM's ACE system, these can be used like normal groups:
1 2 3 |
|
You can also let roles inherit from existing groups as described here:
1 |
|
This will cause the Discord role id 604749064436711444
to inherit all its permissions from group.admin
.
These groups are assigned when a player joins the server, they will sync live if a member gets roles assigned or removed. Alternatively, a user can use /refreshperms on Discord to sync their permissions.
Migrating from third party resources¶
Migrating from a third party Discord ACE permission resource is simple, in this example we will use Badger's DiscordAcePerms resource:
1 |
|
1 |
|
This can then simply be added to the server.cfg or easyadmin_permissions.cfg.
Bot logging channel¶
To create a log channel for the bot, simply copy the channel id (right click, Copy ID) and add the following convar to your server.cfg:
1 |
|
After rebooting your server, the bot should send it's first log message:
Note: ea_botLogChannel prioritises over the Webhook, so if you have the Bot Log configured, the Webhook will not work.
Log Forwarding¶
To make the bot send specific messages into other channels, you can use the configure
command, this accepts the same log types as ea_excludeWebhookFeature
.
Individual logs can also be disabled by using ea_excludeWebhookFeature
, see Configuring.
Available log types are:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Live server status¶
To enable the live server status, create a new channel on your server which is read-only to all roles except the bot, this is required as the bot will constantly update it's original message with the new server infos.
Once you have created the channel and copied it's id, you can configure it with the following convar:
1 |
|
After rebooting your server, the bot should now post the status message in your configured channel:
Chat bridge¶
Note: a recent
chat
version from cfx-server-data is required to use the chat bridge.
The chat bridge needs its own Discord channel, it can be write-able by users, however, do note that messages sent in that channel will be sent to the FiveM server!
1 |
|
Once the convar has been configured, chat messages sent into the Discord channel will be sent into the FiveM server's chat, and vice versa.