Configuration reference

Every setting the bot reads, where it lives, and what it does.

Settings #

NameKindPurpose
CAD_BASE_URLvariableYour docs site's address, such as https://docs.example.com. Use the site's root, not a page.
DISCORD_CLIENT_IDvariableYour Discord application's ID.
DISCORD_PUBLIC_KEYsecretVerifies that requests come from Discord.
DISCORD_TOKENsecretLets the bot keep its slash commands up to date.
DISCORD_GUILD_IDvariable, optionalRegisters commands to this one server instead of every server. Useful for testing, because server commands update instantly.
BRAND_AVATAR_URLvariable, optionalImage shown beside the bot's name in reply footers.
BRAND_SETTINGSKV namespaceStores each server's colour and a record of which commands are registered. Created automatically on first deploy.

Variables live in vars in wrangler.jsonc. Secrets live in Cloudflare: set them with npx wrangler secret put NAME, or in the dashboard under Workers & Pages → your Worker → Settings → Variables and Secrets.

The template's wrangler.jsonc #

jsonc
{
	"name": "ctrlaltbot",
	"main": "src/index.js",
	"compatibility_date": "2026-09-13",
	"compatibility_flags": ["global_fetch_strictly_public"],
	"vars": {
		"CAD_BASE_URL": "https://your-docs.example.com",
		"DISCORD_CLIENT_ID": "YOUR_DISCORD_APPLICATION_ID"
	},
	"kv_namespaces": [{ "binding": "BRAND_SETTINGS" }],
	"triggers": { "crons": ["0 * * * *"] },
	"observability": { "enabled": true }
}
  • name is the Worker's name, which sets its URL. Keep it the same across deploys so the Interactions Endpoint URL in Discord stays valid.
  • compatibility_flags lets the bot reach a docs site in the same Cloudflare account.
  • triggers runs an hourly check that the slash commands match the bot's version.
  • observability keeps the bot's logs in the Cloudflare dashboard, for troubleshooting .

Slash command registration #

The bot registers its own commands with Discord. It checks whenever it starts up and handles its first request, and again every hour, and only contacts Discord when the commands have changed. This needs DISCORD_TOKEN.

Without the token, register the commands yourself from any machine with Node.js:

bash
DISCORD_TOKEN=... DISCORD_CLIENT_ID=... npx ctrlaltbot-register

Add DISCORD_GUILD_ID=... to register them to a single server.

Changing the code #

src/index.js in your bot's repository runs the published package:

js
export { default } from 'ctrlaltbot';

To change how the bot behaves, contribute to ctrlaltbot rather than editing your copy. That way, your changes don't block future updates.