Skip to content

11. Discord roles

Reads the player’s roles from your guild every time they reach the character screen, so removing a role in Discord removes the perk on their next join with nothing to clean up.

Needs a bot in your guild with the Server Members Intent turned on in the Discord developer portal, and its token in server.cfg. The player also has to be running Discord; anyone who is not falls through to whatever Tebex gave them.

Check either with mcperks discord <playerId>.

Leave both empty in config.lua — it is a shared script.

set nuggs_discord_token "your-bot-token"
set nuggs_discord_server "your-server-id-or-invite-link"

“Guild” and “server” are the same thing: Discord’s UI says server, its API says guild, and every Discord server has exactly one 17–20 digit id. nuggs_discord_guild is still read, so an older server.cfg keeps working.

The id Settings → Advanced → Developer Mode on, then right-click your server name → Copy Server ID
An invite Any permanent invite link — resolved to the id at startup, with the console printing which server it matched. An expired or single-use invite cannot be resolved
Option Notes
cacheSeconds How long an answer is kept per identifier, so a full server does not spend its rate limit on the character screen
autoMapByName Match roles to tiers by name when no id says otherwise: a role whose name matches a tier’s id, short or label grants that tier. An explicit entry in a tier’s discord list always wins. Turn it off if you have a role named after a tier that is not meant to grant it
stackRoleSlots Do several slot-granting roles add up? true (default): three roles worth 1 slot each give 3. false: the largest single role wins, for a ladder like BOOSTER 1 / 2 / 3. Independent of Config.Membership.stackPurchasedSlots
roleSlots Slots straight off a role, whether or not it also grants a tier

Role names work here too: ["Server Booster"] = 1.

Every source adds. A role listed here and in a tier’s discord list pays out both — the tier’s own slots plus the number here. Set the number to what you want added on top of the tier.

This adds slots only: a role only listed here does not change the badge, so the sidebar still says STANDARD MEMBER. Put it in a tier’s discord list if it should change that too.