Replace Badger_Discord_API and DiscordAcePerms
Remove Badger_Discord_API and DiscordAcePerms from your server. Scripts that use Badger's exports keep working through LonexOne's bot, with no Discord bot token on your server.
Many scripts read Discord roles through Badger_Discord_API, which needs your own Discord bot and its token in a config file. With Game Permissions, the LonexOne resource answers those scripts instead, using LonexOne's bot.
Before you start#
- Game Permissions needs to be switched on for your community, and the LonexOne resource needs to be version 0.13.0 or newer.
- The LonexOne bot needs to be in your main Discord server.
- If you used DiscordAcePerms, move its groups to the board first. See Import game permissions from a config.
Switch over#
- Click Game permissions under Mechanics, then the Badger compatibility tab. Check Answer for Badger_Discord_API is ticked.
- Take
ensure Badger_Discord_APIandensure DiscordAcePermsout ofserver.cfg. - Delete the
Badger_Discord_APIandDiscordAcePermsfolders from your resources, so nothing starts them again. - Restart the server. The console says Answering scripts that use Badger_Discord_API once it's working.
Scripts that call exports.Badger_Discord_API or exports['Badger_Discord_API'] keep working without changes, and scripts that list Badger_Discord_API under dependency start as before.
If Badger_Discord_API is still running, LonexOne leaves its calls to it and says so in the console.
DiscordVehiclesRestrict, DiscordWeaponPerms and DiscordPedPerms keep working this way. You can also move their lists onto the board and remove them from your server. See Lock vehicles, weapons and peds.
What works the same#
| Call | What it gives |
|---|---|
| GetDiscordRoles | The player's role IDs in your main Discord server, or false if they aren't in it or have no Discord linked. |
| GetRoleIdFromRoleName, FetchRoleID, CheckEqual, GetGuildRoleList | Role IDs and names from your main Discord server. |
| GetDiscordName, GetDiscordNickname, GetDiscordAvatar | The player's Discord name, their nickname in your server and their avatar link. |
| GetGuildName, GetGuildIcon, GetGuildSplash, GetGuildDescription, GetGuildMemberCount, GetGuildOnlineMemberCount | Your main Discord server's details. |
| ResetCaches, ClearCache | Forget what was read, so the next call reads it again. |
| GetDiscordEmail, IsDiscordEmailVerified | Nothing and false. Discord doesn't share emails with bots, so this was the same with Badger. |
Roles are read again at most once a minute per player, and your server's details every ten minutes.
Badger could read more than one Discord server. LonexOne reads your main one, so a script that names another server gets the main one.
Changes in Discord#
Some scripts change people in Discord: SetNickname, AddRole, RemoveRole, SetRoles and ChangeDiscordVoice. Each one is off until you tick it under Changes in Discord and click Save.
- The bot can only give and take roles below its own highest role in your server. Roles above it are left alone, and SetRoles keeps them.
- Every change is listed in your activity log, with the reason the script gave.
- If a change is off or refused, the server console says why.
/refreshPerms#
Players used to type /refreshPerms with DiscordAcePerms. They can keep doing that: it's the same as /refreshperms. Changes reach the game on their own anyway.
See also
Can't find what you need?
Open a ticket in our Discord and someone from the team will help. Found a bug, or missing a feature? Tell us on the feedback board.