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

Configuration file

PolarBot reads one TOML file: --config <path>, or /etc/polarbot/config.toml by default. Every section and every key is optional; the defaults below apply. Unknown keys are rejected at startup so typos are caught. An annotated example is crates/polarbot/config.example.toml.

Secrets never go in this file. A key named token, secret, password or api_key (any case, at any depth) makes the bot refuse to start. Secrets are systemd credentials.

Defaults shown are the Linux ones.

[discord]

KeyTypeDefaultDescription
dev_guild_idinteger (server ID), optionalunsetRegister the slash commands in this one server only, where they appear at once (development). Unset: commands are registered globally. Must not be 0.

[database]

KeyTypeDefaultDescription
pathpath/var/lib/polarbot/polarbot.dbThe SQLite database file. Its directory is the data directory: the threat-list and adult-list caches live next to it. The directory is created if missing and must be writable.

[log]

KeyTypeDefaultDescription
leveltext (tracing filter)infoWhat the process logs to stderr/journald: error, warn, info, debug, trace, or a filter such as polarbot=debug,info. An invalid value falls back to info. (Not the per-server Discord log level.)
jsontrue/falsefalseLog JSON lines (for log collectors) instead of human-readable text.

[scanner]

KeyTypeDefaultDescription
refresh_hoursinteger, 1 to 72024How often each threat list and adult list is downloaded again, in hours. A failed download is retried after an hour; the cached list stays in use.
max_list_bytesinteger, 1 to 107374182467108864Largest accepted list download in bytes (default 64 MiB). A larger download is aborted and the cached list is kept.
threatlistsarray of { name, url } tablesdestroylist: https://raw.githubusercontent.com/phishdestroy/destroylist/main/list.txt
discord-phishing-links: https://raw.githubusercontent.com/nikolaischunk/discord-phishing-links/main/txt/domain-list.txt
Phishing-domain lists (plain domain lists or hosts files). Setting it replaces the defaults; [] turns threat lists off. name must match [a-z0-9_-]+ (at most 64 characters) and be unique: it names the cache file <data dir>/threatlists/<name>.txt. url must be https without credentials. A download that is empty, an HTML page or has no valid entries keeps the previous list.
adultlistsarray of { name, url } tablesstevenblack-porn: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/porn-only/hostsAdult-site domain lists for the separate NSFW-link category (/scanner nsfw-links); they never raise the scam score. Same rules as threatlists, cached as <data dir>/adultlists/<name>.txt; [] turns the category off.

[web]

KeyTypeDefaultDescription
bindaddress:port127.0.0.1:8787Where the OAuth callback server listens. Keep it on localhost and let a reverse proxy (nginx) terminate TLS. The server only runs when both OAuth credentials are present.
public_urlhttps URL, no trailing slashhttps://bot.polarsystems.netPublic base URL of the callback server. The OAuth redirect URI is <public_url>/oauth/callback and must be registered exactly like that in the Discord Developer Portal. Change it to your own domain.

Example

A production file usually needs only the public URL of the OAuth callback:

[log]
level = "info"

[web]
public_url = "https://bot.example.org"