Skip to content

Maqarios/Talon-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord Bot for Arma Reforger Community

This Discord bot is designed to enhance the Arma Reforger community experience by providing various utilities, moderation tools, and server status updates.

Features

  • 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.py file.
    • File watchers for automatic updates on server configuration changes.

Setup

  1. Prerequisites:

    • Python 3.6+
    • pip package manager
  2. Install Dependencies:

    pip install -r requirements.txt
  3. Configuration:

    • Create a config.py file based on the provided example.
    • Fill in the necessary tokens, IDs, and file paths.
  4. Database Setup:

    • The bot uses SQLite for user and log data. Ensure the database file path is correctly configured in config.py.
  5. Run the Bot:

    python bot.py

File Structure

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

Cogs

  • 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).

Utilities

  • 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.

Contributing

Contributions are welcome! Please fork the repository and submit a pull request with your changes.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages