Discord alerts
Bastrel can post its most serious detections to a Discord channel through a webhook. Everything is sent by the server: players never see the webhook.
Set up the webhook
Section titled “Set up the webhook”- In Discord, open the channel settings, then Integrations → Webhooks → New Webhook, and copy its URL.
- In
server.cfg, add:
set bastrel_discord_webhook "https://discord.com/api/webhooks/..."Use set, never setr: setr replicates the value to every connected player, and anyone could then post in your channel or read its name. Do not put the URL in any resource file either: files sent to players can be dumped.
- Restart Bastrel. Without the convar, or with a value that is not a Discord webhook URL (
https://discord.com/api/webhooks/...), Discord alerts stay off and the console says so, without printing the value.
The convar name can be changed in config/main.lua (discord.webhookConvar).
What is sent
Section titled “What is sent”- Every staff alert (what the sanctions decide to alert about, and the
BAS-CN-001second-account alert), with what was applied and the ban id when there is one. - Detections of severity
highandcritical(discord.minSeverityinconfig/main.lua) that did not alert, for example inobserve, with what would have been applied. - When the same detection repeats, one summary with the number of occurrences, not one message each.
- At startup, an alert if the config is invalid and Bastrel runs in forced observe, with the errors.
- A detection of a code flagged
unverified(its event payload was never captured in game) is logged but never sent to Discord, neither as a detection nor in a repeat summary.
An embed shows the code and its description, the player’s server id, their license and discord identifiers, the mode, the actions, the score and the detection id. The player’s name, IP, hardware tokens and license2 are never sent, and the embeds never mention anyone.
The colour follows the severity: green (low), amber (medium, high), red (critical). Texts follow locale in config/main.lua.
Discord limits how fast a webhook can post (about 30 messages a minute per channel). Bastrel queues the embeds and sends one at a time, at most one every discord.intervalMs (2 s by default, in config/modules.lua). When Discord asks to slow down, the embed is kept and sending waits as long as Discord says. A request unanswered after discord.timeoutMs (10 s) is abandoned. When more than discord.queueSize (50) embeds are waiting, the next ones are dropped and counted. Problems are reported in the console at most once a minute (discord.reportMs), never with the URL.
Check that the webhook is not replicated
Section titled “Check that the webhook is not replicated”A client-side script that reads GetConvar('bastrel_discord_webhook', '') must get an empty string: the Bastrel test kit has this check as a scenario.