GameStatsBot is an open-source project that includes the code for a Discord bot designed to add Source and GoldSource servers to a MongoDB database and provide statistics for those servers. The bot is programmed in Python, utilizing the Discord API and dependencies for database integration.
- Easy to customize
- MongoDB database
- Multiple servers support
- Send server's name, ip, map, map thumbnail, player count
- Send all players and their names, scores and playtime
- Send stored information about server
- Install python
- Install and setup Mongodb or use MongoDB Atlas
- Download and unzip this repository
- Install required modules
pip install -r requirements.txt
- Create file .env and put there your discord token and mongodb login details
If you are using mongodb atlas:
MONGODB_STRING='Your-Monhodb-Connection-String'
If you are using normal mongodb
MONGODB_IP_AND_PORT='MongodbIpAndPort'
MONGODB_PASSWORD='MongodbPassword'
The final .env file should looks like something like this:
DISCORD_TOKEN='YourDiscordToken'
MONGODB_IP_AND_PORT='MongodbIpAndPort'
MONGODB_PASSWORD='MongodbPassword'
- Run bot.py
- Install AuthSessionFix on your CS2 server
- Install ServerListPlayersFix on your CS2 server
!add_server (Add game server to the database) | Required role to use this command is games server manager
!del_server (Delete server from the database) | Required role to use this command is games server manager
!servers (List of all servers from the database)
!info (Stored information about the server from the database)
!players (All players of the server with their names, scores and playtime)
!stats (Stats of the server like game, name, description, map, player count, map thumbnail)
-
- Your map thumbnail file should be named exactly as the map name (de_mirage.jpg)
- Upload your thumbnail to the map-thumbnails/your-game-name/
-
- You need to create new folder in map-thumbnails/ and the folder should have name exactly
same as your game name without this characters \, /, :, *, ?, ", <, >, |
If you don't know exactly the game name you can write !stats and the name is in field game. - For example if my game is CS2 I will write !stats and there is this name: Counter-Strike 2 I will remove the special characters so my game folder inside map-thumbnails/ should look like this map-thumbnails/Counter-Strike 2
- You need to create new folder in map-thumbnails/ and the folder should have name exactly
same as your game name without this characters \, /, :, *, ?, ", <, >, |
-
- Edit help messages in help_messages.json.
-
- Edit this string
DISCORD_MANAGE_ROLE
in validators.py.
- Edit this string