Are you looking to add a Discord bot to your FiveM QBCore server? Look no further than zdiscord! This powerful resource allows you to easily manage your server’s whitelist, moderate players, and add useful utilities all through the convenience of Discord. Not only is zdiscord easy to setup, but it also supports QBCore for even more functionality.
In this blog post, we’ll walk you through the steps to installing and setting up zdiscord on your FiveM server. Let’s get started!
Creating a discord bot application
1. Head over to the Discord Developer Portal and make sure you have logged in with your discord account.
2. Click on new application button on the top left side.
3. Enter a name and confirm the pop-up window by clicking the “Create” button.
4. Click on Bot tab on the left side and then click on “add bot” button.
You will get a confirmation popup, Just click on “Yes, do it!” button.
5. You may customize the bot name as well as profile picture according to your choice.
If you don’t do this, your bot will NOT work.
7. Now, Scroll up and generate your discord bot token by clicking on “Reset Token” button.
It may ask you your discord password or 2fa code, Just generate and copy 72 charater token.
Inviting bot to your discord server.
1. On the left side, Click on “General Information” button and then copy the application ID of your discord bot.
2. Copy the following link and replace YOUR-BOT-ID with your bots ID then follow the invite process to your discord from the link.
https://discord.com/api/oauth2/authorize?client_id=YOUR-BOT-ID&permissions=116928&scope=bot%20applications.commands
In my case, It will look like this:-
https://discord.com/api/oauth2/authorize?client_id=1052503812163768320&permissions=116928&scope=bot%20applications.commands
4. You may now see that the bot entered in your discord server but it will remain offline and unusable.
Downloading zdiscord bot
1. Headover to the zdiscord github repository and on the bottom right side – Under releases section, click on the latest repository.
2. Download the zip file.
3. Headover to your QBCore Resources directory and create a new folder. Make sure it’s named “zdiscord“.
4. Extract the zip file inside zdiscord folder.
Configurating zdiscord bot
1. Open the config.js file using any code editor like Visual Studio Code, Notepad++ etc.
2. General Configuration Settings
/** ******************************
* GENERAL CONFIGURATION SETTINGS
********************************/
const LanguageLocaleCode = “en”;
// PUBLIC VALUES
const FiveMServerName = “Yuvraj Verma Roleplay Server”; //FiveM Server Name.
const DiscordInviteLink = “https://discord.gg/6EPNJ2z8qB”; //Your discord invite link.
//Your FiveM Server IP, Write 127.0.0.1 in case of localhost.
const FiveMServerIP = “127.0.0.1”;
3. Discord Bot Settings
// DISCORD BOT
//Replace CHANGE with 72Digit discord bot token which we have generated earlier
const DiscordBotToken = “MTA1MjUwMzgxMjE2Mzc2ODMyMA.Gi2Wnb.SDUmIQiRU2J65QLt5Bt5ZesYjK_xxxx”;
const DiscordGuildId = “000000000000000000”; //Your discord server ID.
3.1 Getting Discord Guild ID.
1. Make sure you have enabled developer mode in Discord.
2. Right click on your discord server, on the bottom – click on “Copy ID” button
4. Whitelisting and Staff chat
// STAFF CHAT
const EnableStaffChatForwarding = true;
//Replace DiscordStaffChannelId with Staff text channel id.
const DiscordStaffChannelId = “000000000000000000”;
const AdditionalStaffChatRoleIds = [
// “000000000000000”,
];
// WHITELISTING / ALLOWLISTING
const EnableWhitelistChecking = true;
//Replace DiscordWhitelistRoleIds with Whitelist Role ID.
const DiscordWhitelistRoleIds = “000000000000000000, 000000000000000000”;
5. Admin Permissions
Replace ID’s with the desired role ID
// SLASH COMMANDS / DISCORD PERMISSIONS
const EnableDiscordSlashCommands = true;
const DiscordModRoleId = “000000000000000000”;
const DiscordAdminRoleId = “000000000000000000”;
const DiscordGodRoleId = “000000000000000000”;
You may refer to zdiscord’s official documentation for indepth config guide:- https://zfbx.github.io/zdiscord/config
Running zdiscord bot
1. Headover to your server cfg and add the following:
Add ensure zdiscord (after qb-core and/or convars you may have)
# QBCore & Extra stuff
ensure qb-core
ensure [qb]
ensure [standalone]
ensure [voice]
ensure [defaultmaps]
ensure zdiscord
Add the following anywhere in your server.cfg:
add_ace resource.zdiscord command allow
add_ace group.zdiscordstaff zdiscord.staffchat allow
2. Run your FiveM Server, and you may see the bot is online in few minutes.
3. You may now be able to use slash commands with this bot.
Standalone Commands: (25)
/announcement [message] - mod+
/embed complex [channel] [json] - god
/embed simple [channel] [message] (title) (image) (thumbnail) (footer) (color) - god
/identifiers [id] - admin+
/kick [id] (message) - mod+
/kickall [message] - admin+
/kill [id] - admin+
/message [id] [message] - mod+
/onlinecount
/players - mod+
/resource ensure [resource] - god
/resource inspect [resource] - god
/resource list - god
/resource refresh - god
/resource start [resource] - god
/resource stop [resource] - god
/server
/screenshot [id] - god
/teleport coords [id] [x] [y] [z] (keepVehicle) - mod+
/teleport preset [id] [location] (keepVehicle) - mod+
/teleport-all coords [x] [y] [z] - god
/teleport-all preset [location] - god
/whitelist toggle [true/false] - god
/whitelist addrole [role] - god
/whitelist removerole [role] - god
QBCore Commands: (27)
/ban [id] [time] [reason] - admin+
/clothing-menu [id] - admin+
/gang kick [id] - admin+
/gang inspect [id] - admin+
/gang set [id] [gang] [grade] - admin+
/inventory give [id] [item] [count] - admin+
/inventory inspect [id] - admin+
/inventory take [id] [item] [count] - admin+
/jail free [id] - mod+
/jail sentence [id] [time] - mod+
/job fire [id] - admin+
/job inspect [id] - admin+
/job set [id] [job] [grade] - admin+
/logout [id] - admin+
/money add [id] [type] [amount] - admin+
/money inspect [id] - admin+
/money remove [id] [type] [amount] - admin+
/money set [id] [type] [amount] - admin+
/permissions add [id] [permission] - god
/permissions remove [id] - god
/revive [id] - admin+
/revive-all - god
/time [hour] - admin+
/vehicle give [id] [spawncode] (plate) - god
/vehicle lookup [plate] - god
/weather blackout - admin+
/weather set [weather] - admin+
A big thanks to Tony (zfbx) and all the contributors for creating this amazing bot and making this available to us.
zdiscord repo:- https://github.com/zfbx/zdiscord
zfbx discord server:- https://discord.com/invite/M6neBU3cvP