A Docker-ready Discord bot that lets each Discord server configure and control its own Counter-Strike 2 server over RCON.
After inviting the bot, run /setup and it will launch an embed-driven setup wizard where admins configure:
- CS2 server host/IP and port
- RCON password
- Which roles/users can use server controls
- Which channel should host the control center
The bot then posts a persistent Control Center embed with live server status and interactive controls.
- Slash command setup flow:
/setup - Fast partial reconfiguration:
/editsetup(no full setup rerun) - Embed-based setup wizard with modal inputs
- Per-server permissions (allowed roles and allowed users)
- Status panel showing:
- RCON connectivity state
- Current players
- Current map
- Current game mode
- One-click
Connect to Serverbutton using Steam protocol - Server controls:
- Map switcher
- Game mode switcher
- Quick actions:
- Restart round
- Pause/unpause match
- Restart match
- Start/end/pause/unpause warmup
- Swap teams
- Scramble teams
- Popular config presets and toggles:
- Headshot Only ON/OFF
- Friendly Fire ON/OFF
- Auto Team Balance ON/OFF
- Docker + Docker Compose
- A Discord account that can create a bot in the Discord Developer Portal
- RCON enabled on your CS2 server
Use this single command:
curl -fsSL https://raw.githubusercontent.com/beaudenison/cs2-rcon-bot/main/install.sh | bashThe installer wizard will:
- Walk you through creating a Discord bot
- Prompts for bot token and client ID
- Optionally enables encrypted-at-rest RCON password storage
- Writes
.envanddocker-compose.ymlto~/cs2-rcon-bot - Pulls the prebuilt Docker image from GHCR
- Starts the container automatically
After install:
cd ~/cs2-rcon-bot && docker compose logs -fPersistent guild configs are stored in ~/cs2-rcon-bot/data/guild-config.json.
The terminal wizard handles setup in this order:
- Install location
- Discord bot creation guidance
- Discord bot token
- Discord application ID
- Optional encrypted-at-rest password storage
Setup wizard sessions are persisted and expire after 30 minutes by default. You can tune this with SETUP_SESSION_TTL_MINUTES in .env.
If your server is slow to answer RCON commands, tune RCON_COMMAND_TIMEOUT_MS (default 5000). This prevents Discord interactions from hanging forever when a server does not respond cleanly.
Status behavior defaults to on-demand mode:
AUTO_STATUS_REFRESH=falsedisables background polling.REFRESH_STATUS_AFTER_ACTION=falseavoids status polling after each control action.- Press the control panel
Refresh Statusbutton anytime to fetch live status on demand. - The installer writes these defaults automatically, so it no longer asks about refresh timing.
The installer itself explains these steps, but the short version is:
- Create a Discord application.
- Add a bot user.
- Copy the Application ID.
- Copy the bot token.
- Invite the bot using scopes
botandapplications.commands.
Developer Portal:
https://discord.com/developers/applications
Invite URL template:
https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&scope=bot%20applications.commands&permissions=274877926400
View logs:
cd ~/cs2-rcon-bot && docker compose logs -fRestart:
cd ~/cs2-rcon-bot && docker compose restartStop:
cd ~/cs2-rcon-bot && docker compose downStart again:
cd ~/cs2-rcon-bot && docker compose up -dIf you want to work on the source directly instead of using the installer:
npm install
cp .env.example .env
npm start- Invite the bot.
- Run
/setupand choose a channel. - Press
Start Setupin the posted wizard embed. - Enter CS2 host/IP, port, and RCON password.
- Select allowed roles/users and press
Complete Setup. - Use the Control Center embed in the selected channel.
If you run one public bot instance, multiple Discord servers can invite it and run /setup independently. Each guild gets isolated configuration in storage.
To offer your hosted bot to others:
- Deploy this project once (Docker on a VPS, cloud VM, or container service).
- Share your bot invite link.
- Keep
datavolume persistent so guild configurations survive restarts.
This repo includes a workflow at .github/workflows/publish-image.yml that publishes:
ghcr.io/beaudenison/cs2-rcon-bot:latest(on pushes to main)- tag versions (when you push tags like
v1.0.0)
To enable public pulls from GHCR:
- Go to your repository packages in GitHub.
- Open the published container package.
- Set visibility to public.
Once public, anyone can run the one-command installer without cloning the repo.
- By default, RCON credentials are stored in
data/guild-config.jsonin plaintext. - Optional encryption at rest is supported:
- Set
ENCRYPT_RCON_PASSWORDS=true - Set
ENCRYPTION_KEYto a 32-byte key as one of:- 64-char hex
- base64 for 32 bytes
- exact 32-char UTF-8 string
- Set
- Generate a key quickly:
openssl rand -hex 32- Restrict file/system access where the bot runs.
- Rotate RCON passwords periodically.
- Use dedicated CS2 server credentials for this bot.
/setup channel:#your-channel- starts setup wizard for the guild./editsetup [channel:#optional-new-channel]- edits connection/permissions/channel without rerunning full setup.
- Slash commands do not appear:
- Verify
DISCORD_CLIENT_IDand token. - Confirm bot has
applications.commandsscope in the invite URL. - Wait a minute for global command propagation.
- Verify
- RCON status shows offline:
- Verify server IP/port and RCON password.
- Ensure your host can reach the game server port.
- Confirm RCON is enabled in the game server config.
.
βββ src/
β βββ config.js
β βββ constants.js
β βββ index.js
β βββ rcon.js
β βββ storage.js
βββ data/
βββ Dockerfile
βββ docker-compose.yml
βββ .env.example