Skip to content

Commit 220dc16

Browse files
committed
update README
1 parent 84c4a5f commit 220dc16

1 file changed

Lines changed: 39 additions & 197 deletions

File tree

README.md

Lines changed: 39 additions & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,46 @@
33
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.
44

55
![Version](https://img.shields.io/badge/version-7.0.0-blue)
6-
![License](https://img.shields.io/badge/license-ISC-green)
76
![Node](https://img.shields.io/badge/node-%3E%3D20-blue)
87

98
## Features
109

10+
### Core Features
11+
12+
- **Real-time Server Monitoring**: Automatically queries game servers at a configurable interval to update server status
13+
- **Embed Channel**: Automatically updates a channel message with rich embed of all configured servers and their status
14+
- **Map Notifications**: Receive DM alerts when followed maps appear on monitored servers
15+
- **Multi-Game Mode Support**: Supports Surf, KZ (kreedz climb), and Bhop map prefixes
16+
- **Slash Commands**: Modern Discord interaction using slash commands with autocomplete support
17+
- **Rate Limiting**: Built-in rate limiting to prevent abuse (configurable per command)
18+
- **IP Validation**: Secure IP address/FQDN validation with private IP blocking
19+
- **Automatic Cleanup**: Automatically removes user follows when they leave the server
20+
- **Caching System**: User and map image caching to reduce API calls
21+
- **Retry Logic**: Exponential backoff for failed server queries
22+
1123
### Public Commands
1224

1325
| Command | Description |
1426
|---------|-------------|
15-
| `--players` / `--p` | Display currently connected players on a specified server |
16-
| `--map` / `--m` | Show the current map on a server or display map statistics |
17-
| `--keywords` / `--keys` | List all available server keywords for searching |
18-
| `--follow` / `--f` | Follow a map to receive DM notifications when it appears on a server |
19-
| `--unfollow` / `--uf` | Stop following a specific map or all maps |
20-
| `--listfollows` / `--lf` | Display all maps you are currently following |
21-
| `--help` / `--commands` | Show a list of all available commands |
22-
| `--ping` | Check bot latency (reacts with ping emoji) |
23-
| `--version` / `--v` | Display the bot version |
27+
| `/players` | Display currently connected players on a specified server |
28+
| `/map` | Show the current map on a server or display map statistics |
29+
| `/keywords` | List all available server keywords for searching |
30+
| `/follow` | Follow a map to receive DM notifications when it appears on a server |
31+
| `/unfollow` | Stop following a specific map or all maps |
32+
| `/listfollows` | Display all maps you are currently following |
33+
| `/help` | Show a list of all available commands |
34+
| `/ping` | Check bot latency |
35+
| `/version` | Display the bot version |
2436

2537
### Administrator Commands
2638

2739
| Command | Description |
2840
|---------|-------------|
29-
| `--id` | Developer command |
30-
| `--mem` | Display current memory usage statistics |
31-
| `--check <IP>` | Check server status by IP address (with rate limiting) |
32-
| `--listallfollows` / `--laf` | List all users and their followed maps |
33-
| `--testnotify <map>` | Test map notification system |
34-
| `--removeuser <userID>` | Remove all map follows for a specific user |
35-
36-
### Core Features
37-
38-
- **Real-time Server Monitoring**: Automatically queries CS:GO servers every 90 seconds to update server status
39-
- **Map Notifications**: Receive DM alerts when followed maps appear on monitored servers
40-
- **Multi-Game Mode Support**: Supports surf, KZ (climb), bhop, and retakes game modes
41-
- **Rate Limiting**: Built-in rate limiting to prevent abuse (configurable per command)
42-
- **IP Validation**: Secure IP address validation with private IP blocking
43-
- **Automatic Cleanup**: Automatically removes user follows when they leave the server
44-
- **Graceful Shutdown**: Proper database connection cleanup on SIGINT/SIGTERM
45-
- **Caching System**: User and map image caching to reduce API calls
46-
- **Retry Logic**: Exponential backoff for failed server queries
41+
| `/check <server>` | Check server status by IP address (admin only) |
42+
| `/mem` | Display current memory usage statistics (admin only) |
43+
| `/listallfollows` | List all users and their followed maps (admin only) |
44+
| `/testnotify <map>` | Test map notification system (admin only) |
45+
| `/removeuser <userID>` | Remove all map follows for a specific user (admin only) |
4746

4847
## Configuration
4948

@@ -75,98 +74,19 @@ A Discord bot that monitors Counter-Strike: Global Offensive (and other supporte
7574
cp config.json.example config.json
7675
```
7776

78-
- Edit `config.json` with your settings (see [Configuration Options](#configuration-options) below)
77+
- Edit `config.json` with your settings (see [Configuration Fields](#configuration-fields) below)
7978

8079
4. **Run the bot**
8180

8281
```bash
8382
npm start
8483
```
8584

86-
### Configuration Options
87-
88-
Create a `config.json` file based on `config.json.example`:
89-
90-
```json
91-
{
92-
"discord": {
93-
"token": "YOUR_BOT_TOKEN_HERE",
94-
"prefix": "!",
95-
"intents": [
96-
"Guilds",
97-
"GuildMessages",
98-
"GuildMessageReactions",
99-
"DirectMessages",
100-
"DirectMessageReactions"
101-
]
102-
},
103-
"security": {
104-
"adminUserIds": ["YOUR_DISCORD_USER_ID_1", "YOUR_DISCORD_USER_ID_2"]
105-
},
106-
"logging": {
107-
"enabled": true,
108-
"guildID": "YOUR_LOG_GUILD_ID",
109-
"channelID": "YOUR_LOG_CHANNEL_ID"
110-
},
111-
"fallback": {
112-
"guildID": "YOUR_FALLBACK_GUILD_ID",
113-
"channelID": "YOUR_FALLBACK_CHANNEL_ID"
114-
},
115-
"serverUpdate": {
116-
"intervalSeconds": 90,
117-
"mapCheckIntervalSeconds": 91,
118-
"maxConcurrentQueries": 10
119-
},
120-
"follow": {
121-
"timeoutSeconds": 30
122-
},
123-
"embeds": [
124-
{
125-
"channelID": "YOUR_EMBED_CHANNEL_ID",
126-
"messageID": "YOUR_EMBED_MESSAGE_ID"
127-
}
128-
],
129-
"cache": {
130-
"userCacheTTLSeconds": 300,
131-
"mapImageCacheTTLSeconds": 86400
132-
},
133-
"retry": {
134-
"maxRetries": 3,
135-
"baseDelaySeconds": 1
136-
},
137-
"gamedig": {
138-
"defaultMaxRetries": 4
139-
},
140-
"embedsConfig": {
141-
"color": 7980240
142-
},
143-
"images": {
144-
"fallbackAvatar": "https://i.imgur.com/cBiDnMi.png",
145-
"offlineServer": "https://i.imgur.com/WnS0Biz.png"
146-
},
147-
"mapUrls": {
148-
"surf": {
149-
"stats": "https://snksrv.com/surfstats/",
150-
"image": "https://bans.snksrv.com/images/maps/"
151-
},
152-
"kz": {
153-
"stats": "https://snksrv.com/kzstats/#/maps/",
154-
"image": "https://raw.githubusercontent.com/KZGlobalTeam/map-images/public/images/"
155-
},
156-
"bhop": {
157-
"stats": "https://snksrv.com/bhopstats/index.php?map=",
158-
"image": "https://bans.snksrv.com/images/maps/"
159-
}
160-
}
161-
}
162-
```
163-
16485
### Configuration Fields
16586

16687
| Field | Type | Required | Default | Description |
16788
|-------|------|----------|---------|-------------|
16889
| `discord.token` | string | Yes | - | Your Discord bot token |
169-
| `discord.prefix` | string | Yes | `!` | Command prefix for the bot |
17090
| `discord.intents` | array | Yes | - | Discord gateway intents required for bot functionality |
17191
| `security.adminUserIds` | array | Yes | - | Discord user IDs with access to admin commands |
17292
| `logging.guildID` | string | Yes | - | Guild ID for logging bot activities |
@@ -189,19 +109,19 @@ The bot supports the following CS:GO game modes with automatic map detection:
189109
### Surf Maps
190110

191111
- **Prefix**: `surf_`
192-
- **Stats URL**: [snksrv.com/surfstats](https://snksrv.com/surfstats/)
112+
- **Default Stats URL**: [snksrv.com/surfstats](https://snksrv.com/surfstats/)
193113
- **Example**: `surf_beginner`
194114

195115
### KZ (Climb) Maps
196116

197117
- **Prefixes**: `kz_`, `bkz_`, `kzpro_`, `skz_`, `vnl_`, `xc_`
198-
- **Stats URL**: [snksrv.com/kzstats](https://snksrv.com/kzstats/)
118+
- **Default Stats URL**: [snksrv.com/kzstats](https://snksrv.com/kzstats/)
199119
- **Example**: `kz_asylum`
200120

201121
### Bhop (Bunnyhop) Maps
202122

203123
- **Prefix**: `bhop`
204-
- **Stats URL**: [snksrv.com/bhopstats](https://snksrv.com/bhopstats/)
124+
- **Default Stats URL**: [snksrv.com/bhopstats](https://snksrv.com/bhopstats/)
205125
- **Example**: `bhop_strix`
206126

207127
## Server Configuration
@@ -224,7 +144,7 @@ Add your CS:GO servers to `servers.json`:
224144

225145
| Field | Type | Required | Description |
226146
|-------|------|----------|-------------|
227-
| `ip` | string | Yes | Server IP and port (e.g., `216.52.143.73:27015`) |
147+
| `ip` | string | Yes | Server IP and port (e.g., `127.0.0.1:27015`) |
228148
| `nick` | string | Yes | Display name shown in embeds |
229149
| `show` | boolean | Yes | Whether to display server in public commands |
230150
| `protocol` | string | No | Game protocol (default: `csgo`) - see list [here](https://github.com/gamedig/node-gamedig/blob/master/GAMES_LIST.md)|
@@ -245,6 +165,7 @@ Add your CS:GO servers to `servers.json`:
245165
- Add Reactions
246166
- Send Messages in Threads
247167
- Use External Emojis
168+
- Use Application Commands
248169

249170
- **Required Intents**:
250171
- Guilds
@@ -253,71 +174,6 @@ Add your CS:GO servers to `servers.json`:
253174
- DirectMessages
254175
- DirectMessageReactions
255176

256-
## Architecture
257-
258-
```mermaid
259-
flowchart TB
260-
subgraph "Bot Initialization"
261-
A[Load config.json] --> B[Initialize SQLite Database]
262-
B --> C[Connect to Discord Gateway]
263-
C --> D[Load Server List from servers.json]
264-
end
265-
266-
subgraph "Main Loop"
267-
E[Server Status Monitor<br/>90s interval] --> F[Query Servers via GameDig]
268-
F --> G[Update Embeds in Discord]
269-
G --> H[Map Change Detector<br/>91s interval]
270-
H --> I[Notify Followed Users]
271-
end
272-
273-
subgraph "User Commands"
274-
J[Message Event] --> K{Command Type}
275-
K -->|Public| L[handlePublicCommand]
276-
K -->|Admin| M[handleDevCommand]
277-
L --> N[Player/Map/Help Commands]
278-
M --> O[Admin Tools]
279-
end
280-
281-
subgraph "Data Persistence"
282-
P[SQLite Database<br/>players_follow table]
283-
Q[User Follows]
284-
R[Map Statistics]
285-
end
286-
287-
D --> E
288-
E --> H
289-
H --> I
290-
J --> K
291-
P --> Q
292-
P --> R
293-
```
294-
295-
## Rate Limiting
296-
297-
The bot implements rate limiting to prevent abuse:
298-
299-
| Command | Limit | Window |
300-
|---------|-------|--------|
301-
| `--follow` | 5 actions | per minute |
302-
| `--unfollow` | 5 actions | per minute |
303-
| `--check` (IP) | 10 actions | per minute |
304-
305-
## Security Features
306-
307-
- **IP Validation**: Validates IPv4 and IPv6 addresses before querying
308-
- **Private IP Blocking**: Prevents scanning of internal network addresses
309-
- **SQL Injection Prevention**: Parameterized queries for all database operations
310-
- **Map Name Sanitization**: Validates and sanitizes map name inputs
311-
- **Mention Prevention**: Blocks user/role mentions in map names
312-
- **Admin-Only Commands**: Restricted admin commands via user ID whitelist
313-
314-
## Error Handling
315-
316-
- **Retry Logic**: Exponential backoff for failed server queries and Discord API calls
317-
- **Graceful Degradation**: Continues operation even if individual servers fail to respond
318-
- **Fallback Notifications**: Sends notifications to fallback channel if DM fails
319-
- **Memory Management**: Automatic cache cleanup and database connection handling
320-
321177
## Troubleshooting
322178

323179
### Bot won't start
@@ -328,44 +184,30 @@ First and foremost, **review all logs**.
328184
- Check that `config.json` exists and is valid JSON
329185
- Ensure all required configuration fields are present
330186

331-
### Commands not working
187+
### Commands not appearing
332188

333-
- Verify the command prefix matches your configuration
334-
- Check that the bot has proper channel permissions
335-
- Ensure your user ID is in the `adminUserIds` list for admin commands
189+
- The bot uses slash commands - type `/` in any channel the bot has access to
190+
- The bot must be invited to your server with proper permissions
191+
- Slash commands may take a few minutes to propagate after the bot starts
192+
- Try using `/help` to see available commands
336193

337194
### Map notifications not working
338195

339196
- Verify `follow.timeoutSeconds` is set appropriately
340197
- Check that the bot can send DMs to users
341198
- Ensure map names match the expected format (alphanumeric, underscores, hyphens)
199+
- Make sure you have `/follow` set for the maps you want notifications for
342200

343201
### Server status not updating
344202

345203
- Check server IP and port in `servers.json`
346204
- Verify the server is accessible from your network
347205
- Review logs for GameDig query errors
348206

349-
## Contributing
350-
351-
1. Fork the repository
352-
2. Create a feature branch
353-
3. Make your changes
354-
4. Test thoroughly
355-
5. Submit a pull request
356-
357-
## License
358-
359-
This project is licensed under the ISC License.
360-
361207
## Author
362208

363209
**Frumpy7**
364210

365211
## Support
366212

367213
For issues and feature requests, please visit the [GitHub Issues](https://github.com/Sneaks-Community/discordCSGOServerBot/issues) page.
368-
369-
---
370-
371-
*Last Updated: 2026-03-07*

0 commit comments

Comments
 (0)