Configuration ​
Everything lives in config.lua. It is a server script on purpose: nothing in it reaches clients except
Config.Presence, which the client needs for rich presence. Secrets never go in here; the bot token, the main guild and
webhook urls are convars (see Installation → server.cfg).
With np_admin running, 40 of these settings can be changed live (see Editable in np_admin).
General ​
| Key | Default | |
|---|---|---|
Config.Debug |
false |
Log every request and gateway event |
Roles, channels and guilds ​
Names for the ids you use all the time. Wherever a role, channel or guild is expected you can pass one of these names, the raw id, or (roles and channels) the name it has on Discord. Naming is optional; see Guilds & discovery.
Config.Roles = {
admin = '123456789012345678',
police = '123456789012345678',
}
Config.Channels = {
chat = '123456789012345678',
status = '123456789012345678',
}
Config.Guilds = {
staff = '123456789012345678', -- just the id, when you only need the guild by name
lspd = {
id = '123456789012345678',
roles = { ['lspd-officer'] = '123456789012345678', ['lspd-chief'] = '123456789012345678' },
channels = { ['lspd-radio'] = '123456789012345678' },
},
}
| Key | Default | |
|---|---|---|
Config.Roles |
{} |
Role names → ids in the main guild |
Config.Channels |
{} |
Channel names → ids in the main guild |
Config.Guilds |
{} |
More guilds (the bot has to be in each): a name → an id, or { id, roles, channels }. Roles and channels listed under a guild remember where they live. Online players are tracked in every guild listed here (one extra request per player and guild on join) |
The guild from discord_guild_id is always called main. All names share one namespace: a name used twice is reported
in the console and the second one is ignored.
Discovery ​
Config.Discovery = { enabled = true, track = 'all', maxTracked = 10, interval = 600 }
| Key | Default | |
|---|---|---|
enabled |
true |
Read every guild the bot is in, no need to list them in Config.Guilds |
track |
'all' |
'all': every guild the bot is in is tracked like a configured one (online players' roles are read there, names resolve without a guild argument). 'configured': only main and Config.Guilds; the others still work when you name them |
maxTracked |
10 |
More discovered guilds than this besides main and Config.Guilds: track none of them |
interval |
600 |
Seconds between re-reads of the guild list without the gateway |
HTTP ​
| Key | Default | |
|---|---|---|
Config.Http.timeout |
15000 |
ms before a request counts as failed |
Config.Http.retries |
3 |
Retries on 429, 5xx and network errors |
Config.Http.maxQueue |
250 |
Pending requests per rate limit bucket before new ones are refused (queue_full) |
Cache ​
Seconds a result stays cached. With the gateway members and roles are kept fresh in real time; without it these are the worst-case delay until a change made on Discord is noticed. Guilds, roles, channels and emojis are refreshed in the background once older than these times, while callers keep getting the copy in memory.
| Key | Default | |
|---|---|---|
Config.Cache.member |
120 |
Members |
Config.Cache.notMember |
30 |
"Not in the guild" answers |
Config.Cache.memberLive |
1800 |
Members while the gateway reports their changes (GUILD_MEMBERS intent) |
Config.Cache.user |
600 |
Users |
Config.Cache.roles |
300 |
Roles, also emojis |
Config.Cache.channels |
300 |
Channels |
Config.Cache.guild |
120 |
Member and online counts |
Sync ​
| Key | Default | |
|---|---|---|
Config.Sync.interval |
5 |
Without the gateway: re-check one online player every N seconds (round robin), so role changes made on Discord reach the game. 0 = off. Players whose first sync failed are retried first, gateway or not |
Whitelist ​
The connection gate. Checked while the player connects. See Ready-made features → Whitelist.
| Key | Default | |
|---|---|---|
Config.Connect.enabled |
false |
Turn the whitelist on |
requireDiscord |
true |
Discord must be running and linked to FiveM |
requireMember |
true |
true = must be in the main guild; { 'main', 'staff' } = in all of these |
roles |
{} |
Needs at least one of these, from any guild. Empty = no role needed |
blockedRoles |
{} |
Refused with any of these, from any guild |
bypass |
{} |
Identifiers that always get in: 'license:…', 'discord:…', 'steam:…' |
failOpen |
false |
Let players in when Discord itself is unreachable |
messages.checking |
'Checking your Discord…' |
Shown while the check runs |
messages.noDiscord |
'Discord was not found. Start Discord, link it in the FiveM settings and reconnect.' |
|
messages.notMember |
'You have to be on our Discord server to play here.' |
|
messages.missingRole |
'You are not whitelisted.' |
|
messages.blocked |
'Your Discord account is not allowed on this server.' |
|
messages.error |
'Discord could not be reached. Please try again in a moment.' |
A role in roles or blockedRoles that cannot be resolved refuses every connection (and says so in the console)
rather than letting everyone in.
Logs ​
See Webhooks & logs.
| Key | Default | |
|---|---|---|
Config.Logs.enabled |
true |
Log returns false and sends nothing when off |
username / avatar |
nil |
Webhook name and avatar override |
flushInterval |
2000 |
ms between batches; embeds are sent ten per message |
maxQueue |
200 |
Entries per channel; the oldest are dropped first |
channels |
{} |
Log name → 'convar', a webhook url (don't commit it) or a bot channel (Config.Channels name or id) |
auto.join |
nil |
Log channel for joins (nil = off) |
auto.leave |
nil |
Leaves, with the drop reason |
auto.chat |
nil |
Chat messages (needs chat) |
auto.death |
nil |
Deaths and kills (needs baseevents) |
auto.resource |
nil |
Resource start and stop |
Chat bridge ​
In-game chat ↔ a Discord channel. Discord → game needs the gateway with the GUILD_MESSAGES and MESSAGE_CONTENT
intents. See Ready-made features → Chat bridge.
| Key | Default | |
|---|---|---|
Config.Chat.enabled |
false |
|
channel |
'chat' |
Channel name or id |
toDiscord |
true |
Game → Discord |
toGame |
true |
Discord → game |
ignoreCommands |
true |
Skip in-game messages starting with / |
discordFormat |
'**{name}** [{id}]: {message}' |
One line on Discord |
gameTag |
'Discord' |
Prefix in the in-game chat |
gameColour |
{ 88, 101, 242 } |
Colour in the in-game chat |
Status ​
A status message the bot keeps up to date, plus the bot's activity line (gateway only). See Ready-made features → Status message.
| Key | Default | |
|---|---|---|
Config.Status.enabled |
false |
The status message |
channel |
'status' |
Channel name or id |
interval |
60 |
Seconds between updates (at least 15) |
title |
'{server}' |
Embed title |
colour |
'blurple' |
Embed colour |
showPlayers |
true |
List player names (max 40) |
connect |
nil |
Connect address shown in the embed, e.g. 'cfx.re/join/abcdef' |
activity |
'{players}/{max} players' |
The bot's activity text, nil = leave it alone. Works without enabled but needs the gateway |
Gateway ​
| Key | Default | |
|---|---|---|
Config.Gateway.enabled |
false |
Open the live connection. Needs the Node 22 runtime |
intents |
{ 'GUILDS', 'GUILD_MEMBERS', 'GUILD_MODERATION', 'GUILD_VOICE_STATES', 'GUILD_MESSAGES' } |
What the gateway receives. See Gateway → Intents |
GUILD_MEMBERS, GUILD_PRESENCES and MESSAGE_CONTENT are privileged: switch them on in the developer portal before
listing them here.
Job roles ​
Framework jobs → Discord roles for es_extended and qb-core / qbx_core. See Ready-made features → Job roles.
Config.JobRoles = {
enabled = true,
removeOld = true,
jobs = {
police = 'police',
ambulance = { role = 'ems', grades = { [3] = 'ems-lead' } },
},
}
| Key | Default | |
|---|---|---|
Config.JobRoles.enabled |
false |
|
removeOld |
true |
Take the old job's role away on a job change |
jobs |
{} |
Job name → a role, or { role, grades = { [grade] = role } }. A role from another guild is given in that guild |
Rich presence ​
Shown on the player's own Discord profile. The only table sent to clients. See Client → Rich presence.
| Key | Default | |
|---|---|---|
Config.Presence.enabled |
false |
|
appId |
nil |
Application id (string) that owns the art assets |
largeAsset / largeText |
nil / '{server}' |
Large image and its tooltip |
smallAsset / smallText |
nil / nil |
Small image and its tooltip |
text |
'{players}/{max} players' |
Placeholders: {players} {max} {name} {id} {server} |
buttons |
{} |
Up to two { label, url } |
interval |
30 |
Seconds between refreshes |
Editable in np_admin ​
With np_admin running, 40 settings are edited on its settings page (Resource settings →
Discord). config.lua stays the default; np_admin stores only the overrides. The fields are defined in
shared/np_admin_settings.lua, which is loaded as a server script, so every field has scope server. np_admin is
optional; without it config.lua is all there is.
| Category | Settings | Applies |
|---|---|---|
| General | Debug logging, request timeout, role re-check interval (Sync.interval) |
live |
| General | Gateway on / off | restart |
| Cache | Member cache, "not a member" cache | live |
| Whitelist | On / off, require linked Discord, require main guild membership (on / off; a list of guilds stays in config.lua), allowed roles, blocked roles, bypass identifiers, let players in when Discord is down, the messages for not a member, missing role and blocked |
live |
| Logs | Logs on / off, batch interval, join / leave / chat / resource log channels | live |
| Logs | Death log channel (switching it on or off needs a restart, because it listens to client events only when on; renaming applies live) | restart |
| Chat bridge | Channel, skip /commands, Discord line format | live |
| Chat bridge | On / off, game → Discord, Discord → game | restart |
| Status | Channel, update interval, list player names, connect address | live |
| Status | Status message on / off, bot activity | restart |
| Job roles | Remove the old job role, job → role map (JSON) | live |
| Job roles | On / off | restart |
| Presence | Rich presence on / off, presence text | next join |
Not exposed: the token and webhook urls (convars), the guild / role / channel id maps, Logs.channels (may hold
webhook urls), Gateway.intents and the rich presence art.
np_discord registers no permission nodes and does not forward its own logs to np_admin. It is the other way round: np_admin sends its logs through np_discord (see np_admin → Discord).