İçeriğe geç
txAdmin Discord bot

txAdmin Discord bot

Set up txAdmin's built in Discord bot: create the application, token and intents, invite it, add the live status embed with /status add, and use Discord whitelisting.

Bu dokümanlar şimdilik İngilizce.

Last updated

txAdmin has a Discord bot built in. You don’t host anything extra: txAdmin itself logs in as your bot. It gives you:

  • a persistent status embed that updates every minute (online state, players, next restart, uptime, connect buttons),
  • Discord based whitelisting (member of your server, or has a role),
  • slash commands for staff, like whitelisting a player and looking up player info,
  • an optional announcements channel where txAdmin posts server events such as restarts.
Plays from youtube-nocookie.com after you click.

1. Create the Discord application

  1. Go to the Discord Developer Portal and click New Application. Name it after your server.
  2. Open the Bot page.
  3. Click Reset Token and copy the token. Treat it like a password: anyone with it controls your bot.
  4. Under Privileged Gateway Intents, enable Server Members Intent. Without it the bot can’t see who is in your Discord, and member or role whitelisting fails.
  5. Optional: turn off Public Bot so nobody else can invite it.

2. Invite it to your Discord

  1. Open OAuth2 > URL Generator.
  2. Scopes: bot and applications.commands.
  3. Bot permissions: at least View Channels, Send Messages, Embed Links and Read Message History (the status embed is a message the bot edits).
  4. Open the generated URL and add the bot to your server.

3. Configure txAdmin

In txAdmin, Settings > Discord Bot:

Field Value
Enabled On
Token The bot token from step 1
Guild / Server ID Right click your server icon in Discord > Copy Server ID (enable Developer Mode in Discord’s Advanced settings first)
Announcements channel Optional. Right click a channel > Copy Channel ID. txAdmin posts server events (like restarts) there.

Save. The txAdmin System Logs page shows whether the bot logged in or why it failed.

4. Add the status embed

In the channel where you want the status, type:

Text
/status add

The bot posts an embed and keeps editing it every minute. It needs permission to send messages in that channel. To move it, run /status add in the new channel and delete the old message.

Customise the embed

Settings > Discord Bot has two JSON editors, the embed JSON and the config JSON. The embed supports these placeholders (from txAdmin’s discord-status docs):

Placeholder Value
{{serverName}} txAdmin’s name for the server
{{serverClients}} / {{serverMaxClients}} Players online / slots
{{serverJoinUrl}} https://cfx.re/join/xxxxxx
{{serverBrowserUrl}} Server browser page
{{serverCfxId}} Your server’s Cfx.re ID
{{statusString}} / {{statusColor}} Online, partial or offline text and colour from the config JSON
{{uptime}} For example 1 hr, 50 mins
{{nextScheduledRestart}} For example in 2 hrs, 48 mins

A minimal embed:

Embed JSON
{
  "title": "{{serverName}}",
  "url": "{{serverBrowserUrl}}",
  "description": "Press Connect below, or F8 and `connect cfx.re/join/xxxxxx`.",
  "fields": [
    { "name": "> STATUS", "value": "```\n{{statusString}}\n```", "inline": true },
    { "name": "> PLAYERS", "value": "```\n{{serverClients}}/{{serverMaxClients}}\n```", "inline": true },
    { "name": "> NEXT RESTART", "value": "```\n{{nextScheduledRestart}}\n```", "inline": true },
    { "name": "> UPTIME", "value": "```\n{{uptime}}\n```", "inline": true }
  ]
}

And the config, which sets the status texts, colours and up to 5 link buttons:

Config JSON
{
  "onlineString": "Online",
  "onlineColor": "#0BA70B",
  "partialString": "Partial",
  "partialColor": "#FFF100",
  "offlineString": "Offline",
  "offlineColor": "#A70B28",
  "buttons": [
    { "emoji": "1062338355909640233", "label": "Connect", "url": "{{serverJoinUrl}}" },
    { "emoji": "1062339910654246964", "label": "Rules", "url": "https://example.com/rules" }
  ]
}

color and footer are set by txAdmin, so leave them out. txAdmin can’t validate the embed until Discord accepts it: if it doesn’t appear, check System Logs. A visual editor like discohook.org helps (paste the object inside its embeds array). The emoji fields take a unicode emoji or a custom emoji ID; replace the example IDs above with your own.

5. Discord whitelisting

In Settings > Player Manager, set the whitelist mode:

  • Discord member: anyone in your Discord server can join. Good against random joiners and ban evaders who don’t want to rejoin your Discord.
  • Discord role: only members with one of the roles you pick. The classic “Whitelisted” role for RP servers. Your application team gives the role, the player can join.

Players must have Discord running and linked to FiveM so the server receives their discord: identifier. If they get “not whitelisted” while having the role, it’s almost always that: Discord wasn’t open when they launched FiveM.

For Approved license mode, staff can approve requests from Discord with the bot’s whitelist command instead of opening the panel.

Troubleshooting

Problem Fix
Bot offline Wrong token (reset it and paste again), or the bot is disabled in settings. Check System Logs.
Whitelist says everyone is not a member Server Members Intent not enabled, or wrong Guild ID.
/status add does nothing Slash commands take a moment to register after the bot joins. Also check the bot has permission in that channel.
Embed never updates Someone deleted the message. Run /status add again.
Custom emoji don’t show The bot must be in the server that owns the emoji, and the ID must be right.

The official txAdmin channel also has a short video on removing an admin from the bot, linked in the video archive.