Skip to content

Discord patchnotes ​

The UPDATE section can automatically display patchnotes / announcements posted in a Discord channel: you write your updates in Discord, they appear in the loading screen. No file editing required.

TIP

Patchnotes are cached: they show instantly on load, then refresh automatically in the background each time the server starts.

Configuration — config/discord.lua ​

lua
return {
    BotToken = "",       -- Your Discord bot token (keep it secret!)
    ChannelID = "",      -- ID of the channel to read
    MessageLimit = 10,   -- Number of messages to display (1-20)
    Debug = true,        -- Verbose server logs (set false in prod)
}
FieldDescription
BotTokenYour Discord bot token. Never share it.
ChannelIDID of the Discord channel to read (e.g. #patchnotes)
MessageLimitNumber of messages fetched (1 to 20)
DebugDetailed logs in the FXServer console (request, response, counts, cache write)

Step-by-step setup ​

1. Create a Discord application & bot ​

  1. Go to the Discord Developer Portal.
  2. New Application → name it → confirm.
  3. Bot tab → Add Bot → Yes, do it!.
  4. Under the bot name, Reset Token then copy it → paste into BotToken.

WARNING

Never share your token publicly. Anyone who has it can control your bot.

2. Invite the bot to your Discord server ​

  1. OAuth2 tab → URL Generator.
  2. Scopes: check bot.
  3. Bot Permissions, at minimum:
    • ✔ Read Messages / View Channels
    • ✔ Read Message History
  4. Copy the generated URL, open it, select your server, Authorize.

3. Get the channel ID ​

  1. Discord → Settings → Advanced → Developer Mode (enable it).
  2. Right-click the target channel (e.g. #patch-notes) → Copy Channel ID.
  3. Paste it into ChannelID.

4. Discord message format ​

Messages posted in the channel follow this structure:

Line 1       → Patchnote title
---          → Separator (optional, ignored)
Remaining    → Description / details

Example message to post:

v1.3.0 - Major Update
---
- Added 10 new vehicles
- Fixed server crash on job start
- New faction: Special Forces
- Performance improvements

NOTE

If a message has no text (empty content) but contains an embed, the script automatically pulls the embed's title + description.

5. Restart the server ​

Once BotToken, ChannelID and MessageLimit are set, restart the FiveM server. Messages are fetched and displayed automatically.

Manual fallback (without Discord) ​

If you don't want to use Discord, leave BotToken/ChannelID empty and fill the updates directly in config/config.js:

js
update: {
    title: "UPDATE",
    elements: [
        {
            title: "v1.2.0",
            description: "- Added new vehicles\n- Fixed bugs\n- Improved performance",
            date: "11/01/2026",
            author: "Admin",
        },
        {
            title: "v1.1.0",
            description: "- New jobs added\n- Economy rebalance",
            date: "05/01/2026",
        },
    ],
},
FieldDescription
titleVersion number or name
descriptionDetails (\n for a line break)
date(optional) Update date
author(optional) Author

These elements only show if Discord returns no message.

Security & escrow ​

IMPORTANT

config/discord.lua contains your token: it is listed in escrow_ignore of fxmanifest.lua, so it stays editable even on an escrow resource. Never commit your real token to a public repository.

Troubleshooting ​

Enable Debug = true and check the FXServer console:

Console messageMeaning
ChannelID ou BotToken manquantOne of the two fields is empty in discord.lua
Discord error: 401Invalid token
Discord error: 403The bot can't access the channel (permissions / invite)
Discord error: 404Wrong ChannelID
Messages bruts reçus: 0The channel is empty, or the bot can't see the history
Cache écrit dans data/discord_cache.js (OK)Everything works ✅