This Discord bot is designed to enhance the Arma Reforger community experience by providing various utilities, moderation tools, and server status updates.
-
User Management:
- Register new users and manage their roles.
- Track user activity and team assignments.
- Link Bohemia IDs to Discord users for in-game integration.
-
Moderation Tools:
- Log and manage user misconduct with categories and severity levels.
- Commands to view user-specific logs.
-
Server Status:
- Display real-time server utilization (CPU, Memory, Disk).
- Monitor active players on the game server.
- Track active mods.
-
Team Management:
- Monitor user team changes passively through Discord role assignments.
- Display team compositions and member join dates.
- Track team assignment history and logs.
-
Configuration:
- Easily configurable through a
config.pyfile. - File watchers for automatic updates on server configuration changes.
- Easily configurable through a
-
Prerequisites:
- Python 3.6+
pippackage manager
-
Install Dependencies:
pip install -r requirements.txt
-
Configuration:
- Create a
config.pyfile based on the provided example. - Fill in the necessary tokens, IDs, and file paths.
- Create a
-
Database Setup:
- The bot uses SQLite for user and log data. Ensure the database file path is correctly configured in
config.py.
- The bot uses SQLite for user and log data. Ensure the database file path is correctly configured in
-
Run the Bot:
python bot.py
DiscordBot/
├── bot.py # Main bot file
├── config.py # Configuration settings
├── cogs/ # Cog files for different functionalities
│ ├── __init__.py
│ ├── misc.py # Miscellaneous commands (ping, privacy, restart server)
│ ├── user.py # User management and misconduct logging commands
│ ├── serverconfig.py # Server configuration commands (change scenario)
│ ├── mos.py # MOS related commands (loadout management)
│ └── log.py # Log viewing commands
├── utils/ # Utility modules
│ ├── __init__.py
│ ├── utils.py # Helper functions (server status, time formatting)
│ ├── database_managers.py# Database management classes
│ ├── active_messages.py # Logic for updating active status messages
│ ├── file_watchers.py # File monitoring for server configuration
│ ├── loggers.py # Logging configuration and setup
│ ├── misc.py # Miscellaneous utilities (e.g., LoadoutSnapshotter)
│ ├── website_scrapers.py # Website scraping utilities
│ └── cache.py # Caching mechanisms
├── dbs/ # Database files (not tracked by Git)
├── .gitignore # Specifies intentionally untracked files
├── README.md # Documentation
└── requirements.txt # Python dependencies
- UserCog: Manages user registration, deletion, team assignments, and Bohemia ID linking.
/register: Registers the user in the database./register_user: Registers a specified user in the database (Admin only)./delete_user: Deletes a specified user from the database (Admin only)./show_user_team_logs: Shows a user's team logs (Admin only)./link_user_bohemia_id: Links a Bohemia ID to a user with autocomplete for unknown players (Admin only).
- MisconductCog: Handles misconduct logging and management.
/add_misconduct: Adds a misconduct record for a user with category/type autocomplete (Admin only)./show_misconducts: Shows the misconduct logs for a specified user (Admin only).
- MiscCog: Includes general utility commands.
/ping: Checks the bot's latency./privacy: Displays the privacy policy./restart_gameserver: Restarts the game server (Admin only)./update_gameserver: Updates the game server (Admin only)./start_testserver: Starts the test server (Admin only)./restart_testserver: Restarts the test server (Admin only)./stop_testserver: Stops the test server (Admin only).
- ServerConfigCog: Allows administrators to change server settings like the scenario ID.
/change_scenario: Changes the server scenario (Admin only)./change_servername: Changes the server name (Admin only)./change_testserver_scenario: Changes the test server scenario (Admin only)./change_testservername: Changes the test server name (Admin only).
- MosCog: MOS related commands for loadout management.
/delete_user_loadout: Deletes all loadout files for a specified user (MP role only)./start_mos_check: Copies the loadout from a specified user to the command invoker (MP role only)./stop_mos_check: Restores the original loadout of the command invoker (MP role only)./give_user_kit: Gives a specified user a pre-defined kit in a specific slot (Admin only).
- LogCog: Provides commands to view game logs.
/show_gm_activity: Shows recent GM activity logs with various filters (CO, MPO and AO only).
- Database Managers: Provides classes for interacting with the SQLite database, including user management, role logs, and misconduct logs.
- Active Messages: Manages and updates Discord messages that display dynamic information, such as server status and team compositions.
- File Watchers: Real-time monitoring system with specialized watchers:
- ServerAdminToolsStatsFileWatcher: Monitors JSON statistics files for server performance data (FPS, uptime, player count, entities, etc.) and connected players list with automatic sorting
- ServerConfigFileWatcher: Tracks server configuration changes including game settings, mods, scenario IDs, and network configuration with automatic data sanitization and mod searchability
- GenericFileWatcher: Base class providing extensible file monitoring framework using watchdog library with automatic change detection and threading support
- LoadoutSnapshotter: Monitors loadout files and creates timestamped backups upon modification, managing a history of snapshots.
- Loggers: Centralized logging configuration with both console and file output for debugging and monitoring.
- Cache: Caching mechanisms for storing and quickly accessing data, such as Bohemia IDs.
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
This project is licensed under the MIT License.