Updates and upgrading
How the bot stays up to date, and how to move an older deployment onto the current setup.
Your bot's repository holds only your settings. The bot itself is the ctrlaltbot npm package, so updating means moving to a newer version of that package.
Automatic updates #
Bots set up with the Deploy button update like this:
- When a new version is published, Dependabot opens a pull request in your bot's repository.
- For minor and patch versions, such as 1.1.2 to 1.1.3, the repository's
auto-updateworkflow merges it automatically. - Cloudflare rebuilds and redeploys the bot from the merged change.
- If the new version changes the slash commands, the bot updates them with Discord itself.
Major versions, such as 1 to 2, may need changes on your side, so they wait for you to merge them. Read the changelog first.
To check for updates now, open your repository's Insights → Dependency graph → Dependabot and select Check for updates.
Manual updates #
For bots deployed from your own machine:
npm update ctrlaltbot
npx wrangler deployWhen an update needs a settings change #
Updates change the bot's code but not your wrangler.jsonc. When a release needs a settings change, its changelog entry says so. For example, 1.1.1 added the global_fetch_strictly_public compatibility flag for docs sites in the same Cloudflare account.
Upgrading from cad-discord #
Before version 1.1.0, the bot was called cad-discord. It was installed from a release archive, and its commands were registered by hand. To move a deployment onto ctrlaltbot without changing anything in Discord, keep the Worker's name. The bot's URL then stays the same, and its secrets stay attached.
Make a folder from the template
bashgit clone https://github.com/ctrl-alt-doc/ctrlaltbot.git cp -r ctrlaltbot/template my-bot cd my-bot npm installCopy your settings across
In the new
wrangler.jsonc, setname,CAD_BASE_URL, andDISCORD_CLIENT_IDto the values from your oldwrangler.jsonc. To keep each server's colour, give the storage binding your old namespace ID:jsonc"kv_namespaces": [{ "binding": "BRAND_SETTINGS", "id": "your-existing-namespace-id" }],The binding must be named
BRAND_SETTINGS, even if your old one had a different name.Check the secrets
bashnpx wrangler secret listYou need both
DISCORD_PUBLIC_KEYandDISCORD_TOKEN. Older versions didn't use the token, so it may be missing. Add it withnpx wrangler secret put DISCORD_TOKEN.Deploy
bashnpx wrangler deployThe bot registers its new commands, including
/ask, the next time someone uses it.Remove the old server-only commands
If your old setup had
DISCORD_GUILD_IDin its.env, its commands were registered to one server. The new bot registers them for every server, so that server now shows each command twice. See Duplicate commands to remove the old copies.Turn on automatic updates (optional)
Push the folder to a GitHub repository, then connect it in the Cloudflare dashboard under Workers & Pages → your Worker → Settings → Builds → Connect.