FearlessStudios

Discord Status Webhook

Maintain one live FS-Scoreboard status message in Discord

The optional status webhook creates one Discord message and edits that same message with live server, player, department, civilian-service, and connection information.

Setup

  1. Create an incoming webhook in the desired Discord channel.
  2. Open server_config.lua in the built FS-Scoreboard resource.
  3. Set Enabled = true and paste the complete webhook URL into WebhookUrl.
  4. Optionally set the bot avatar, server thumbnail, F8 command, and connect link.
  5. Restart FS-Scoreboard.
server_config.lua
Config.StatusWebhook = {
    Enabled = true,
    WebhookUrl = "https://discord.com/api/webhooks/.../...",
    MessageId = "",
    UpdateOnRosterChange = true,
    Username = "FS Scoreboard",
    AvatarUrl = "https://example.com/avatar.png",
    ThumbnailUrl = "https://example.com/community-logo.png",
    ConnectCommand = "connect play.example.com",
    ConnectUrl = "https://cfx.re/join/abc123"
}

server_config.lua is loaded only by the server and is excluded from escrow, so the webhook token is not included in client or NUI payloads.

Message ID storage

Leave MessageId blank for normal setup. After creating the message, FS-Scoreboard saves its ID in server resource KVP storage under:

fs_scoreboard:status_webhook_message_id

Set MessageId only when you want to force a specific existing webhook message. If the stored message is deleted, the next refresh creates and remembers a replacement.

Update behavior

  • The message refreshes every 30 seconds.
  • Join, leave, and roster changes trigger an additional update after an internal three-second debounce.
  • Discord rate limits are respected using the retry delay returned by Discord.
  • Invalid or forbidden webhooks are disabled until the resource restarts to avoid repeatedly sending failed requests.

These intervals are internal and do not need server configuration.

Embed contents

  • Green Online or red Offline server state and embed accent
  • Current players and configured maximum players
  • Dispatch, LEO, Fire, and EMS values in available / on duty format
  • Configured civilian-service availability
  • Optional F8 connect command and direct connect link
  • Active source or framework mode in the footer
  • Discord's automatic last-updated timestamp

Shutdown behavior

The txAdmin serverShuttingDown event sends an immediate offline update. Stopping the resource directly also attempts the offline update as a fallback.

Unexpected shutdowns

A process crash, forced termination, or power loss cannot run an in-process shutdown handler. Use an external monitor if those failures must also update Discord.