Set up the bot
Create a Discord application and deploy ctrlaltbot to your Cloudflare account.
Each server runs its own copy of ctrlaltbot, in your own Cloudflare account, pointed at your own docs site.
Set up with the Deploy button #
Create the Discord application
In the Discord Developer Portal , create an application. Then note three values:
- Application ID and Public Key, from General Information.
- Bot token, from Bot. Select Reset Token to reveal it.
Keep the token secret. Anyone with it can act as your bot.
Deploy to Cloudflare
Open Deploy to Cloudflare and fill in:
Field Value CAD_BASE_URLYour docs site's address, for example https://docs.example.comDISCORD_CLIENT_IDThe Application ID DISCORD_PUBLIC_KEYThe Public Key DISCORD_TOKENThe bot token Cloudflare creates a repository for your bot in your GitHub or GitLab account, creates the storage the bot needs, and deploys it. When it finishes, copy the Worker's URL, such as
https://ctrlaltbot.your-name.workers.dev.Connect Discord to the bot
Back in the Developer Portal, open General Information and paste the Worker URL into Interactions Endpoint URL. Discord checks the endpoint when you save.
Saving also prompts the bot to register its slash commands, so
/askand/docsappear within a minute or two.Invite the bot to your server
Open this link with your Application ID in place of
YOUR_APPLICATION_ID, then choose your server:texthttps://discord.com/oauth2/authorize?client_id=YOUR_APPLICATION_ID&scope=bot+applications.commandsTry it
In your server, run
/askwith a question your docs answer.
From now on, updates install themselves. See Updates and upgrading .
Set up without the Deploy button #
You can deploy from your own machine or CI instead. You need Node.js 20 or later.
git clone https://github.com/ctrl-alt-doc/ctrlaltbot.git
cp -r ctrlaltbot/template my-bot
cd my-bot
npm installEdit the vars in wrangler.jsonc, then sign in to Cloudflare, add the two secrets, and deploy:
npx wrangler login
npx wrangler secret put DISCORD_PUBLIC_KEY
npx wrangler secret put DISCORD_TOKEN
npx wrangler deployWrangler creates the bot's storage on the first deploy. Then continue from step 3 above.
To get updates automatically, push the folder to a GitHub repository and connect it to the Worker in the Cloudflare dashboard, under Workers & Pages → your Worker → Settings → Builds → Connect. Otherwise, update by hand. See Updates and upgrading .
Test on one server first #
While trying things out, set DISCORD_GUILD_ID to your test server's ID in wrangler.jsonc vars. The bot then registers its commands to that server only, where changes appear instantly. Remove it when you're ready for the commands to be available everywhere the bot is invited.
For all settings, see the Configuration reference .