Best Discord Bot for CS2 Servers: Complete Guide 2026
A Discord bot for your CS2 server is no longer optional. It's essential. From real-time server stats to automated moderation, the right bot transforms your community management.
Why Your CS2 Server Needs a Discord Bot
Real-Time Server Status
Players can check if your server is online, see the current map, and view player count without leaving Discord.
Automated Moderation
Bots handle spam, toxic behavior, and rule enforcement automatically, freeing you to focus on server development.
Community Engagement
Leaderboards, achievements, and stats keep your community active even when they're not playing.
Server Management
Admins can restart servers, change maps, and kick players directly from Discord.
Essential Features of a CS2 Discord Bot
Server Status Integration
Your bot should display:
- Online/offline status with auto-updates
- Current map and game mode
- Player count with player list
- Server FPS and tickrate
- Next map in rotation
Player Statistics
Track and display in Discord:
- K/D ratio and accuracy
- Recent match results
- Weekly/monthly leaderboards
- Achievement unlocks
- Playtime tracking
Moderation Tools
Essential moderation features:
- Auto-moderation for spam and links
- Warning system with escalation
- Temporary and permanent bans
- Mute and timeout commands
- Audit logging
Server Control Commands
Admin commands for:
- Map changes (
!map de_dust2) - Server restart (
!restart) - Player kick/ban (
!kick,!ban) - Config changes (
!setting mp_maxrounds 30) - Plugin management
Building a Custom CS2 Discord Bot
Technology Stack
Recommended stack:
- Language: Node.js with Discord.js v14
- Database: MySQL for persistent stats
- Real-time: Socket.io for server communication
- Hosting: VPS or dedicated server
Getting Started
Initialize the project:
mkdir cs2-discord-bot
cd cs2-discord-bot
npm init -y
npm install discord.js mysql2 socket.io-client dotenv
Basic bot structure:
const { Client, GatewayIntentBits, EmbedBuilder } = require('discord.js');
require('dotenv').config();
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
]
});
client.once('ready', () => {
console.log(`Bot online as ${client.user.tag}`);
});
client.login(process.env.DISCORD_TOKEN);
Server Status Command
client.on('interactionCreate', async interaction => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === 'status') {
const query = new SourceQuery('127.0.0.1', 27015);
const info = await query.getInfo();
const embed = new EmbedBuilder()
.setTitle(info.hostname)
.addFields(
{ name: 'Map', value: info.map, inline: true },
{ name: 'Players', value: `${info.players}/${info.maxPlayers}`, inline: true },
{ name: 'Status', value: '🟢 Online', inline: true }
)
.setColor('#00ff00');
await interaction.reply({ embeds: [embed] });
}
});
Stats Tracking
async function trackPlayerStats(playerId, matchData) {
const [result] = await db.execute(
'INSERT INTO player_stats (player_id, kills, deaths, assists, map) VALUES (?, ?, ?, ?, ?)',
[playerId, matchData.kills, matchData.deaths, matchData.assists, matchData.map]
);
return result;
}
Slash Commands Setup
const { REST, Routes } = require('discord.js');
const commands = [
{
name: 'status',
description: 'Check CS2 server status'
},
{
name: 'stats',
description: 'View player statistics',
options: [{
name: 'player',
description: 'Player name',
type: 3,
required: false
}]
},
{
name: 'leaderboard',
description: 'View server leaderboard'
},
{
name: 'map',
description: 'Change server map (admin only)',
options: [{
name: 'mapname',
description: 'Map name',
type: 3,
required: true
}]
}
];
const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_TOKEN);
await rest.put(
Routes.applicationGuildCommands(process.env.CLIENT_ID, process.env.GUILD_ID),
{ body: commands }
);
Integrating Bot with CS2 Server
RCON Connection
Connect your bot to the CS2 server via RCON:
const Rcon = require('rcon-client').Rcon;
async function sendRconCommand(command) {
const rcon = await Rcon.connect({
host: '127.0.0.1',
port: 27015,
password: process.env.RCON_PASSWORD
});
const response = await rcon.send(command);
await rcon.end();
return response;
}
Event Listeners
Listen for server events:
function setupServerListeners() {
socket.on('player_connect', (data) => {
const channel = client.channels.cache.get(CHANNEL_ID);
channel.send(`**${data.name}** joined the server! 🎮`);
});
socket.on('player_disconnect', (data) => {
const channel = client.channels.cache.get(CHANNEL_ID);
channel.send(`**${data.name}** left the server.`);
});
socket.on('match_end', async (data) => {
await postMatchSummary(data);
});
}
Advanced Bot Features
Economy System
Create an in-community economy:
- Earn coins for playing matches
- Spend coins on custom titles
- Bet on match outcomes
- Trade items with other players
Achievement System
Track player achievements:
- First kill, first win
- Kill streaks (5k, 10k, etc.)
- Map mastery badges
- Community contributions
Tournament Support
Run community tournaments:
- Bracket generation
- Match scheduling
- Score tracking
- Winner announcements
Web Dashboard Integration
Connect your bot to a web dashboard:
- View detailed stats online
- Manage bot settings
- Configure notifications
- Monitor bot health
Deployment and Hosting
Self-Hosting
Requirements:
- VPS with 1GB RAM minimum
- Node.js 18+ installed
- PM2 for process management
- MySQL database
PM2 setup:
npm install -g pm2
pm2 start bot.js --name cs2-bot
pm2 save
pm2 startup
Cloud Hosting
Recommended providers:
- DigitalOcean ($5/month droplet)
- Hetzner (€3.29/month)
- OVH (€3.50/month)
Best Practices
Security
- Never commit tokens to git
- Use environment variables
- Implement rate limiting
- Validate all user input
- Use HTTPS for webhooks
Performance
- Cache frequently accessed data
- Use connection pooling for database
- Implement command cooldowns
- Monitor memory usage
Community Guidelines
- Clear bot commands documentation
- Respect player privacy
- Transparent data collection
- Regular backups of stats
Conclusion
A custom Discord bot elevates your CS2 server from just a game to a full community experience. Whether you build from scratch or customize existing solutions, the investment pays off in player retention and engagement.
Need a custom Discord bot? I build professional Discord bots with CS2 server integration, stats tracking, and moderation starting at €99.
View Discord bot services or contact me to discuss your project.