Releases: hackletloose/hall-switch-me
Release list
3.0.0
Changelog
All notable changes to this project will be documented in this file.
[3.0.0] — 2025-10-26
🚨 Breaking changes
- Environment variable rename:
.envnow usesAPI_BASE_URLS(plural) instead ofAPI_BASE_URL.
This enables multiple CRCON instances. You must update your environment. See “Migration guide” below. - API request body:
switch_player_nownow sendsplayer_id(Steam64 / platform ID) instead ofplayer_name.
The bot andapi_client.pyhave 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
.envstructure: IntroducedAPI_BASE_URLSto accept a comma-separated list (or JSON array) of base URLs that all share the sameAPI_TOKEN.- Logging: Minor improvements to daily log rotation and compression.
Fixed
- More robust handling of
get_detailed_players/get_gamestateresponses before switching.
Migration guide
1) Update your .env
Rename API_BASE_URL → API_BASE_URLS and list all CRCON endpoints (sharing the same token).
Before
API_BASE_URL=https://rcon.example.com
API_TOKEN=your-shared-tokenAfter (comma-separated)
API_BASE_URLS=https://rcon.example.com,https://rcon2.example.com
API_TOKEN=your-shared-tokenAlternative (JSON array)
API_BASE_URLS=["https://rcon.example.com","https://rcon2.example.com"]
API_TOKEN=your-shared-tokenNotes
• Keep using a singleAPI_TOKENif all instances share it.
• Do not include trailing slashes in URLs.
• Remove unusedUSERNAME/PASSWORDvariables (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.pynow posts{"player_id": "<Steam64>"}to/api/switch_player_now.bot.pydiscovers the correct CRCON by checking eachAPI_BASE_URLSendpoint 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.comDeprecations
- Single-endpoint
API_BASE_URLis kept as a fallback for now, but will be removed in a future major release. Please migrate toAPI_BASE_URLS.
Team Switch Limit and Queue System Implemented – API Token Authentication Upgrade
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_gamestateAPI 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.
- Integrated the
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_playerswithget_detailed_playersto 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.pyversion 2.x. - Details:
- Moved background task handling (
process_switch_queue) to thesetup_hookmethod to align with new discord.py event handling. - Ensured the bot remains compatible with the latest versions of discord.py.
- Moved background task handling (
6. Updated Translations
- Enhancement: Added English translations for international support and updated existing messages in the
translations.jsonfile. - 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.
- Integration des API-Endpunkts
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_playersdurchget_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.pyVersion 2.x zu folgen. - Details:
- Die Hintergrundaufgabe (
process_switch_queue) wurde in die Methodesetup_hookverschoben, um die neue Ereignisverwaltung vondiscord.pyzu unterstützen. - Sicherstellung der Kompatibilität des Bots mit den neuesten Versionen von discord.py.
- Die Hintergrundaufgabe (
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
Changelog
Updated bot.py and api_client.py to support new API endpoints:
-
Renamed API Methods:
do_switch_player_nowrenamed toswitch_player_now.- Parameter
playerindo_switch_player_nowrenamed toplayer_name. - Updated method return type to
bool.
-
Replaced API Endpoint:
- Replaced
get_player_by_steam_idwithget_player_profile. - Adjusted the bot to use the new endpoint for retrieving player profiles.
- Replaced
-
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.
-
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.