Team Management Features: - Added 6 new IRC commands: \!teamlist, \!activeteam, \!teamname, \!teamswap, \!heal, \!verifyteamswap - \!teamlist shows teams with pet names in format "Team name - pet1 - pet2 - pet3" - \!teamname redirects to web interface for secure PIN-based renaming - \!teamswap enables team switching with PIN verification via IRC - \!activeteam displays current team with health status indicators - \!heal command with 1-hour cooldown for pet health restoration Critical Bug Fixes: - Fixed \!teamlist SQL binding error - handled new team data format correctly - Fixed \!wild command duplicates - now shows unique species types only - Removed all debug print statements and implemented proper logging - Fixed data format inconsistencies in team management system Production Improvements: - Added logging infrastructure to BaseModule and core components - Converted 45+ print statements to professional logging calls - Database query optimization with DISTINCT for spawn deduplication - Enhanced error handling and user feedback messages Cross-platform Integration: - Seamless sync between IRC commands and web interface - PIN authentication leverages existing secure infrastructure - Team operations maintain consistency across all interfaces 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
36 lines
No EOL
1.5 KiB
Python
36 lines
No EOL
1.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Team builder module for PetBot - handles PIN delivery and verification"""
|
|
|
|
from .base_module import BaseModule
|
|
|
|
class TeamBuilder(BaseModule):
|
|
"""Handles team builder PIN system and IRC integration"""
|
|
|
|
def get_commands(self):
|
|
return [] # No direct IRC commands, only web interface
|
|
|
|
async def handle_command(self, channel, nickname, command, args):
|
|
# No direct commands handled by this module
|
|
pass
|
|
|
|
async def send_team_builder_pin(self, nickname, pin_code, team_name=None):
|
|
"""Send PIN to player via private message"""
|
|
team_text = f" for {team_name}" if team_name else ""
|
|
message = f"""🔐 Team Builder Verification PIN{team_text}: {pin_code}
|
|
|
|
This PIN will expire in 10 minutes.
|
|
Enter this PIN on the team builder web page to confirm your team changes.
|
|
|
|
⚠️ Keep this PIN private! Do not share it with anyone."""
|
|
|
|
self.send_pm(nickname, message)
|
|
self.logger.info(f"🔐 Sent team builder PIN to {nickname}: {pin_code}{team_text}")
|
|
|
|
async def cleanup_expired_data(self):
|
|
"""Clean up expired PINs and pending requests"""
|
|
try:
|
|
result = await self.database.cleanup_expired_pins()
|
|
if result["success"] and (result["pins_cleaned"] > 0 or result["changes_cleaned"] > 0):
|
|
self.logger.info(f"🧹 Cleaned up {result['pins_cleaned']} expired PINs and {result['changes_cleaned']} pending changes")
|
|
except Exception as e:
|
|
self.logger.error(f"Error during cleanup: {e}") |