A Discord bot that monitors Counter-Strike: Global Offensive (and other supported) servers, provides real-time server status updates, and notifies users when specific maps appear on followed servers.
- Real-time Server Monitoring: Automatically queries game servers at a configurable interval to update server status
- Embed Channel: Automatically updates a channel message with rich embed of all configured servers and their status
- Map Notifications: Receive DM alerts when followed maps appear on monitored servers
- Multi-Game Mode Support: Supports Surf, KZ (kreedz climb), and Bhop map prefixes
- Slash Commands: Modern Discord interaction using slash commands with autocomplete support
- Rate Limiting: Built-in rate limiting to prevent abuse (configurable per command)
- IP Validation: Secure IP address/FQDN validation with private IP blocking
- Automatic Cleanup: Automatically removes user follows when they leave the server
- Caching System: User and map image caching to reduce API calls
- Retry Logic: Exponential backoff for failed server queries
| Command | Description |
|---|---|
/players |
Display currently connected players on a specified server |
/map |
Show the current map on a server or display map statistics |
/keywords |
List all available server keywords for searching |
/follow |
Follow a map to receive DM notifications when it appears on a server |
/unfollow |
Stop following a specific map or all maps |
/listfollows |
Display all maps you are currently following |
/help |
Show a list of all available commands |
/ping |
Check bot latency |
/version |
Display the bot version |
| Command | Description |
|---|---|
/check <server> |
Check server status by IP address (admin only) |
/mem |
Display current memory usage statistics (admin only) |
/listallfollows |
List all users and their followed maps (admin only) |
/testnotify <map> |
Test map notification system (admin only) |
/removeuser <userID> |
Remove all map follows for a specific user (admin only) |
- Node.js: Version 20 or higher
- Discord Bot Token: Create a bot application at Discord Developer Portal
- SQLite: Required for map follow data persistence (handled by
better-sqlite3package)
-
Clone the repository
git clone https://github.com/Sneaks-Community/discordCSGOServerBot.git cd discordCSGOServerBot -
Install dependencies
npm install
-
Configure the bot
-
Copy the example environment file:
cp .env.example .env
-
Edit
.envwith your settings (see Environment Variables below)
-
-
Configure servers
- Edit
servers.jsonwith your game server details (see Server Configuration below)
- Edit
-
Run the bot
npm start
All configuration is done via environment variables. Copy .env.example to .env and configure as needed.
| Variable | Required | Default | Description |
|---|---|---|---|
DISCORD_TOKEN |
Yes | - | Your Discord bot token |
ADMIN_USER_IDS |
Recommended | - | Comma-separated Discord user IDs with admin access |
LOGGING_ENABLED |
No | true |
Enable/disable logging |
LOG_GUILD_ID |
No | - | Guild ID for logging bot activities |
LOG_CHANNEL_ID |
No | - | Channel ID for logging bot activities |
FALLBACK_GUILD_ID |
No | - | Fallback guild ID for DM failures |
FALLBACK_CHANNEL_ID |
No | - | Fallback channel ID for DM failures |
EMBEDS |
No | [] |
JSON array of embed configs: [{"channelID":"xxx","messageID":"yyy"}] |
EMBED_COLOR |
No | 7980240 |
Embed color in decimal |
SERVER_UPDATE_INTERVAL |
No | 90 |
Server status update interval (seconds) |
MAP_CHECK_INTERVAL |
No | 91 |
Map change check interval (seconds) |
MAX_CONCURRENT_QUERIES |
No | 10 |
Maximum concurrent server queries |
FOLLOW_TIMEOUT |
No | 30 |
Timeout for follow/unfollow actions (seconds) |
USER_CACHE_TTL |
No | 300 |
User cache TTL (seconds) |
MAP_IMAGE_CACHE_TTL |
No | 86400 |
Map image cache TTL (seconds) |
RETRY_MAX_RETRIES |
No | 3 |
Maximum retry attempts for failed operations |
RETRY_BASE_DELAY |
No | 1 |
Base delay for exponential backoff (seconds) |
GAMEDIG_MAX_RETRIES |
No | 4 |
Maximum retries for GameDig queries |
FALLBACK_AVATAR_URL |
No | https://i.imgur.com/cBiDnMi.png |
Fallback avatar URL |
OFFLINE_SERVER_IMAGE |
No | https://i.imgur.com/WnS0Biz.png |
Offline server image URL |
MAP_URLS_SURF_STATS |
No | https://snksrv.com/surfstats/ |
Surf stats URL |
MAP_URLS_SURF_IMAGE |
No | https://bans.snksrv.com/images/maps/ |
Surf map image URL |
MAP_URLS_KZ_STATS |
No | https://snksrv.com/kzstats/#/maps/ |
KZ stats URL |
MAP_URLS_KZ_IMAGE |
No | https://raw.githubusercontent.com/KZGlobalTeam/map-images/public/images/ |
KZ map image URL |
MAP_URLS_BHOP_STATS |
No | https://snksrv.com/bhopstats/index.php?map= |
Bhop stats URL |
MAP_URLS_BHOP_IMAGE |
No | https://bans.snksrv.com/images/maps/ |
Bhop map image URL |
RATE_LIMIT_FOLLOW_PER_MINUTE |
No | 5 |
Max follow commands per minute per user |
RATE_LIMIT_UNFOLLOW_PER_MINUTE |
No | 5 |
Max unfollow commands per minute per user |
RATE_LIMIT_IP_CHECK_PER_MINUTE |
No | 10 |
Max IP check commands per minute per user |
The bot supports the following CS:GO game modes with automatic map detection:
- Prefix:
surf_ - Default Stats URL: snksrv.com/surfstats
- Example:
surf_beginner
- Prefixes:
kz_,bkz_,kzpro_,skz_,vnl_,xc_ - Default Stats URL: snksrv.com/kzstats
- Example:
kz_asylum
- Prefix:
bhop - Default Stats URL: snksrv.com/bhopstats
- Example:
bhop_strix
Add your CS:GO servers to servers.json:
{
"ServerName": {
"ip": "IP_ADDRESS:PORT",
"nick": "Display Name",
"show": true,
"protocol": "csgo",
"keywords": ["keyword1", "keyword2"]
}
}| Field | Type | Required | Description |
|---|---|---|---|
ip |
string | Yes | Server IP and port (e.g., 127.0.0.1:27015) |
nick |
string | Yes | Display name shown in embeds |
show |
boolean | Yes | Whether to display server in public commands |
protocol |
string | No | Game protocol (default: csgo) - see list here |
keywords |
array | Yes | Search keywords for the server |
- Node.js v20.x or higher
- Docker (optional, for containerized deployment)
-
Bot Permissions:
- Send Messages
- Embed Links
- Read Message History
- Add Reactions
- Send Messages in Threads
- Use External Emojis
- Use Application Commands
-
Required Intents:
- Guilds
- GuildMessages
- GuildMessageReactions
- DirectMessages
- DirectMessageReactions
The bot can be run in a Docker container for easy deployment. The Docker image uses a multi-stage build with node:22-alpine for a minimal footprint (~100MB).
-
Clone and configure
git clone https://github.com/Sneaks-Community/discordCSGOServerBot.git cd discordCSGOServerBot -
Create environment file
cp .env.example .env nano .env # Edit with your Discord token and settings -
Configure servers
Edit
servers.jsonwith your game server details. -
Build and run
docker-compose up -d
-
View logs
docker-compose logs -f
# Build the image
docker build -t discord-csgo-bot .
# Run the container
docker run -d \
--name csgo-server-bot \
--env-file .env \
-v $(pwd)/servers.json:/app/servers.json:ro \
-v bot-data:/app/data \
discord-csgo-botAll configuration options can be set via environment variables. See .env.example for the full list.
| Variable | Required | Description |
|---|---|---|
DISCORD_TOKEN |
Yes | Your Discord bot token |
ADMIN_USER_IDS |
Yes | Comma-separated Discord user IDs |
LOG_GUILD_ID |
No | Guild ID for logging |
LOG_CHANNEL_ID |
No | Channel ID for logging |
FALLBACK_GUILD_ID |
No | Fallback guild for DMs |
FALLBACK_CHANNEL_ID |
No | Fallback channel for DMs |
EMBEDS |
No | JSON array of embed configs |
SERVER_UPDATE_INTERVAL |
No | Server update interval (seconds) |
MAP_CHECK_INTERVAL |
No | Map check interval (seconds) |
The Docker compose setup uses named volumes:
bot-data- SQLite database storage
# Pull latest changes
git pull
# Rebuild and restart
docker-compose up -d --build- Container won't start: Check that
DISCORD_TOKENis set in your.envfile - Commands not working: Ensure slash commands have propagated (may take a few minutes)
- Database errors: Check volume permissions and disk space
- Permission denied: Ensure the
bot-datavolume exists and is accessible
First and foremost, review all logs.
- Verify your Discord token is correct and has proper permissions
- Check that
.envfile exists and containsDISCORD_TOKEN - Ensure all required environment variables are set
- The bot uses slash commands - type
/in any channel the bot has access to - The bot must be invited to your server with proper permissions
- Slash commands may take a few minutes to propagate after the bot starts
- Try using
/helpto see available commands
- Verify
follow.timeoutSecondsis set appropriately - Check that the bot can send DMs to users
- Ensure map names match the expected format (alphanumeric, underscores, hyphens)
- Make sure you have
/followset for the maps you want notifications for
- Check server IP and port in
servers.json - Verify the server is accessible from your network
- Review logs for GameDig query errors
Frumpy7
For issues and feature requests, please visit the GitHub Issues page.