Skip to content

Releases: hackletloose/hall-switch-me

3.0.0

25 Oct 22:20

Choose a tag to compare

Changelog

All notable changes to this project will be documented in this file.

[3.0.0] — 2025-10-26

🚨 Breaking changes

  • Environment variable rename: .env now uses API_BASE_URLS (plural) instead of API_BASE_URL.
    This enables multiple CRCON instances. You must update your environment. See “Migration guide” below.
  • API request body: switch_player_now now sends player_id (Steam64 / platform ID) instead of player_name.
    The bot and api_client.py have been updated accordingly.

Added

  • Multi-RCON support: The bot can query multiple CRCON endpoints and automatically selects the correct one based on where the player is currently connected.
  • Resilient player lookup: ID-first matching with safe fallback to name match when needed.
  • Queue logic across servers: The switch queue re-detects the player’s current server at processing time (no stale server binding).

Changed

  • .env structure: Introduced API_BASE_URLS to accept a comma-separated list (or JSON array) of base URLs that all share the same API_TOKEN.
  • Logging: Minor improvements to daily log rotation and compression.

Fixed

  • More robust handling of get_detailed_players / get_gamestate responses before switching.

Migration guide

1) Update your .env

Rename API_BASE_URLAPI_BASE_URLS and list all CRCON endpoints (sharing the same token).

Before

API_BASE_URL=https://rcon.example.com
API_TOKEN=your-shared-token

After (comma-separated)

API_BASE_URLS=https://rcon.example.com,https://rcon2.example.com
API_TOKEN=your-shared-token

Alternative (JSON array)

API_BASE_URLS=["https://rcon.example.com","https://rcon2.example.com"]
API_TOKEN=your-shared-token

Notes
• Keep using a single API_TOKEN if all instances share it.
• Do not include trailing slashes in URLs.
• Remove unused USERNAME / PASSWORD variables (not used by the current code).
• Never commit real tokens to your repository.

2) No DB migration required

The existing users(discord_id, steam_id, player_name) table remains valid.
steam_id is used as player_id for switching.

3) Code expectations

  • api_client.py now posts {"player_id": "<Steam64>"} to /api/switch_player_now.
  • bot.py discovers the correct CRCON by checking each API_BASE_URLS endpoint for the player presence.

Examples

Minimal .env example

DISCORD_BOT_TOKEN=your-discord-bot-token
ALLOWED_CHANNEL_ID=123456789012345678
LANGUAGE=de
DB_FILE=switch.db
COMMAND_SWITCH=switch
COMMAND_REG=reg

API_TOKEN=your-shared-token
API_BASE_URLS=https://rcon.example.com,https://rcon2.example.com

Deprecations

  • Single-endpoint API_BASE_URL is kept as a fallback for now, but will be removed in a future major release. Please migrate to API_BASE_URLS.

Team Switch Limit and Queue System Implemented – API Token Authentication Upgrade

10 Oct 20:26

Choose a tag to compare

Changelog


English Version

1. Team Player Limit for Switching

  • New Feature: Implemented a restriction that only allows players to switch teams if the target team has fewer than 50 players.
  • Details:
    • Integrated the get_gamestate API to check the current number of players on both teams.
    • Updated the bot to verify the player count on the target team before allowing a switch.

2. Queue System for Full Teams

  • New Feature: Added a queue system for players attempting to switch when the target team is full (50 players).
  • Details:
    • Players are added to a queue if the target team is at capacity.
    • The bot checks every 10 seconds if space is available and switches the first player in the queue when possible.

3. API Token Authentication

  • Improvement: Removed the need for username and password in the API authentication process, relying solely on the API token.
  • Details:
    • Removed username and password from configuration and authentication.
    • The bot now uses only the API token to authenticate requests.

4. Switched to Using get_detailed_players API

  • Enhancement: Replaced get_players with get_detailed_players to obtain more detailed player information, including team affiliation and roles.
  • Details:
    • This allows for more accurate team and player tracking during switches.

5. Refactor of Discord.py Code

  • Code Update: Refactored parts of the code to follow best practices with discord.py version 2.x.
  • Details:
    • Moved background task handling (process_switch_queue) to the setup_hook method to align with new discord.py event handling.
    • Ensured the bot remains compatible with the latest versions of discord.py.

6. Updated Translations

  • Enhancement: Added English translations for international support and updated existing messages in the translations.json file.
  • Details:
    • Provided translations for new features such as queue notifications and API initialization.

Deutsche Version

1. Spielerbegrenzung beim Teamwechsel

  • Neue Funktion: Implementierung einer Begrenzung, die es Spielern nur erlaubt, das Team zu wechseln, wenn das Zielteam weniger als 50 Spieler hat.
  • Details:
    • Integration des API-Endpunkts get_gamestate, um die aktuellen Spielerzahlen auf beiden Teams zu überprüfen.
    • Der Bot prüft nun die Spieleranzahl auf dem Zielteam, bevor ein Wechsel erlaubt wird.

2. Warteschlangensystem für volle Teams

  • Neue Funktion: Hinzufügen eines Warteschlangensystems für Spieler, die das Team wechseln möchten, wenn das Zielteam voll ist (50 Spieler).
  • Details:
    • Spieler werden zur Warteschlange hinzugefügt, wenn das Zielteam die maximale Spieleranzahl erreicht hat.
    • Der Bot überprüft alle 10 Sekunden, ob Platz verfügbar ist, und wechselt den ersten Spieler in der Warteschlange, sobald dies möglich ist.

3. API-Token-Authentifizierung

  • Verbesserung: Entfernung der Notwendigkeit von Benutzername und Passwort in der API-Authentifizierung, wobei jetzt nur noch der API-Token verwendet wird.
  • Details:
    • Benutzername und Passwort wurden aus der Konfiguration und Authentifizierung entfernt.
    • Der Bot verwendet nun ausschließlich den API-Token zur Authentifizierung der Anfragen.

4. Wechsel zu get_detailed_players API

  • Erweiterung: Ersetzung von get_players durch get_detailed_players, um detaillierte Spielerinformationen einschließlich Teamzugehörigkeit und Rollen zu erhalten.
  • Details:
    • Dies ermöglicht eine genauere Verfolgung der Teams und Spieler während des Wechsels.

5. Refactoring des Discord.py-Codes

  • Code-Update: Teile des Codes wurden refaktoriert, um den Best Practices von discord.py Version 2.x zu folgen.
  • Details:
    • Die Hintergrundaufgabe (process_switch_queue) wurde in die Methode setup_hook verschoben, um die neue Ereignisverwaltung von discord.py zu unterstützen.
    • Sicherstellung der Kompatibilität des Bots mit den neuesten Versionen von discord.py.

6. Aktualisierte Übersetzungen

  • Verbesserung: Hinzufügen englischer Übersetzungen für internationale Unterstützung und Aktualisierung bestehender Nachrichten in der Datei translations.json.
  • Details:
    • Bereitstellung von Übersetzungen für neue Funktionen wie Warteschlangenbenachrichtigungen und API-Initialisierung.

1.2.0

26 Aug 19:40

Choose a tag to compare

Changelog

Updated bot.py and api_client.py to support new API endpoints:

  1. Renamed API Methods:

    • do_switch_player_now renamed to switch_player_now.
    • Parameter player in do_switch_player_now renamed to player_name.
    • Updated method return type to bool.
  2. Replaced API Endpoint:

    • Replaced get_player_by_steam_id with get_player_profile.
    • Adjusted the bot to use the new endpoint for retrieving player profiles.
  3. Updated Bot Logic:

    • Refactored the bot command handling to accommodate the changes in API methods and response structures.
    • Enhanced error handling based on the updated API response formats.
  4. Code Clean-up:

    • Minor adjustments in the logic to ensure smooth integration with the updated API.

These changes ensure compatibility with the latest API modifications.

1.1.2 Hotfix

07 Apr 14:06

Choose a tag to compare

Hotfix bot.py

1.1.0 Hotfix

07 Apr 13:13

Choose a tag to compare

Update 1.1

Command Fix

1.0.0

04 Apr 21:36

Choose a tag to compare

Release