The ultimate FiveM Discord resource, that allows you to check Discord role(s). With the ability to grant Ace permissions and chat roles based on a Discord role(s).
Tired of having multiple Discord resources, just to be able to grant Ace permissions, chat roles, and check if a user has a certain Discord Role? Well, look no further. DiscordAPI integrates the 3 most common Discord resources, into one, while enhancing and optimizing them. It will grant and revoke ace groups and permissions, it will grant and revoke chat tags, and will let you check for roles, all based on Discord role(s).
- Applies permissions based on Discord roles, this means you can apply group permissions and unique permissions such as command permissions.
- Removes all permissions, to ensure no one has any permission they're not supposed to.
- In-game chat tags based on Discord roles.
- Display server ID within their chat message.
- Ability to check for certain Discord Roles.
- Lightweight resource, no unrequired code.
- Expand the API features. (Check for Discord role, check for Discord permission, etc.)
This image contains the server ID at the front (White text):
- Download the latest release.
- Drag DiscordAPI into your resource folder.
- Go to your server.cfg, and write "start DiscordAPI"
- In your server.cfg, add the following lines:
add_ace resource.DiscordAPI command.add_principal allow
add_ace resource.DiscordAPI command.add_ace allow
add_ace resource.DiscordAPI command.remove_principal allow
add_ace resource.DiscordAPI command.remove_ace allow
add_ace group.admin "DiscordAPI:StaffChat" allow
- Change group.admin to your lowest ranking staff group that you'd like to be able to access staff chat.
- Configure the resource to your liking.
That's it! If everything went correctly, the next time you start your server, you'll see DiscordAPI outputting messages within the console.
A sample configuration comes default with the resource, use that as a reference on how to configure the resource properly.
You'll need to provide a Discord bot token, for the resource to access your Discord to get the information required to grant chat tags and permissions to your players.
Provide the Discord Server ID of the Discord Server you'd like to base the chat tag and permissions off of.
Simple true/false option, if it's enabled, the resource will grant chat tags and enable staff chat.
This is a table that contains the {Discord Role ID, "Chat Tag"}. If you'd like to grant a tag to all users, enter 0 as the Discord Role ID.
Simple true/false option, if it's enabled, it'll add the users' server ID before their chat tag and name.
A list of roles you'd like to check for using the exports.
Simple true/false option, if it's enabled, the resource will grant permissions to users joining.
This table will contain the Discord Role ID as a key, and what role to grant as the value.
This table will contain the Discord Role ID as a key, and what permissions to grant as values within the table.
If you'd like to replace discord_perms with DiscordAPI, you'll need to replace the following lines in all the resources you use within your server:
- Replace exports["discord_perms"]:IsRolePresent with exports["DiscordAPI"]:isRolePresent
- Replace exports["discord_perms"]:GetRoles with exports["DiscordAPI]:getRoles
Check out the releases page for the newest version.
DiscordAPI is a very lightweight resource and will not cause any performance issues for you while ensuring permissions and chat tags are correctly and accurately applied.
NOTE: This image shows the performance of the initial release. It doesn't include the performance improvements made in the latest release (v2).
Credit to the following resources and their authors for giving me the idea to create a centralized resource.
discord_perms
DiscordAcePerms
DiscordChatRoles
If you've found a bug, you can go ahead and create an issue.
If you've improved the resource, feel free to make a pull request!
Copyright © 2024 Ricky Bhatti.
This project is GNU GPL v3.0 licensed.