Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Command line and exit codes

The polarbot binary runs the bot, or one offline subcommand. It never takes secrets as arguments.

Usage

usage: polarbot [--config <path>]
       polarbot export-training --out <file.jsonl> [--config <path>]
FormWhat it does
polarbot [--config <path>]Runs the bot. Without --config it reads /etc/polarbot/config.toml. Stops cleanly on SIGTERM or Ctrl-C (at most 10 s for open work).
polarbot export-training --out <file.jsonl> [--config <path>]Writes every stored training example as one JSON line (text, category, verdict, created_at) to a new file with mode 0600, then deletes the exported rows. Refuses an existing file or a missing database. Run it while the bot is stopped or as the service user.
polarbot --helpPrints the usage and exits with status 2.

Exit codes

StatusMeaningsystemd
0Stopped normally (SIGTERM or Ctrl-C).Not restarted.
1Fatal error: unreadable or invalid config file, missing discord_token, database error, Discord rejected the login, or every gateway connection ended.Restarted after 5 s (Restart=on-failure), at most 5 times in 10 minutes.
2Bad command line.Restarted like 1 (fix the unit’s ExecStart).
78Configuration problem a restart cannot fix: Discord closed the gateway with a fatal close code, e.g. 4014 (privileged intents not enabled) or 4004 (bad token). The log says which.Not restarted (RestartPreventExitStatus=78). Fix the cause, then systemctl reset-failed polarbot and start it.

Discord gateway intents

PolarBot connects with these intents. The three privileged ones must be enabled under Bot → Privileged Gateway Intents in the Developer Portal, or Discord closes the connection with 4014 and the bot exits with status 78.

IntentPrivileged
GUILDSno
GUILD_MEMBERSyes
GUILD_MODERATIONno
GUILD_EMOJIS_AND_STICKERSno
GUILD_INTEGRATIONSno
GUILD_WEBHOOKSno
GUILD_INVITESno
GUILD_VOICE_STATESno
GUILD_PRESENCESyes
GUILD_MESSAGESno
GUILD_MESSAGE_REACTIONSno
GUILD_MESSAGE_TYPINGno
MESSAGE_CONTENTyes
GUILD_SCHEDULED_EVENTSno
AUTO_MODERATION_EXECUTIONno