A Discord bot for querying Source engine game servers (CS:GO, TF2, etc.). Allows Discord server administrators to add game servers and users to query them for real-time information like player count, current map, and server status.
- Server Management: Administrators can add and remove game servers for their Discord server
- Real-time Queries: Users can query servers to get current player count, map, and server info
- Autocomplete: Smart autocomplete for server names when querying
- Per-Guild Storage: Each Discord server has its own list of configured game servers
- Docker Support: Easy deployment using Docker
- Python 3.13 or higher
- A Discord bot token
- uv package manager (optional, for development)
-
Clone the repository:
git clone https://github.com/yourusername/querybot.git cd querybot -
Build the Docker image:
docker build -t querybot . -
Run the bot:
docker run -e TOKEN=your_discord_bot_token -e DB_PATH=/data/querybot.db -v /path/to/data:/data querybot
-
Clone the repository:
git clone https://github.com/yourusername/querybot.git cd querybot -
Install dependencies:
pip install -r requirements.txt # or using uv uv sync -
Set environment variables:
export TOKEN=your_discord_bot_token export DB_PATH=/path/to/database.db # optional, defaults to /querybot.sqlite3
-
Run the bot:
python src/main.py # or using uv uv run python src/main.py
The bot requires the following environment variables:
TOKEN: Your Discord bot token (required)DB_PATH: Path to the SQLite database file (optional, defaults to/querybot.sqlite3)
These commands require administrator permissions:
/addserver name:<name> hostname:<hostname> port:<port>- Add a game server to the list/removeserver name:<name>- Remove a game server from the list/listserver- List all configured servers for this Discord server
/query query:<server_name>- Query a configured server by name/query query:<hostname:port>- Query any server by hostname and port
The bot supports querying any Source engine game server, including:
- Counter-Strike: Global Offensive (CS:GO)
- Team Fortress 2 (TF2)
- Garry's Mod
- And many more Source engine games
src/
├── main.py # Bot entry point
└── querybot/
├── database.py # SQLite database operations
├── util.py # Utility functions
└── cog/
├── admin.py # Admin commands
└── query.py # Query commands
discord.py- Discord API wrapperaiosqlite- Asynchronous SQLite database accesspython-a2s- Source engine server querying library
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions, please open an issue on GitHub.