🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
35 lines
No EOL
1.4 KiB
Python
35 lines
No EOL
1.4 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):
|
|
"""Send PIN to player via private message"""
|
|
message = f"""🔐 Team Builder Verification PIN: {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)
|
|
print(f"🔐 Sent team builder PIN to {nickname}: {pin_code}")
|
|
|
|
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):
|
|
print(f"🧹 Cleaned up {result['pins_cleaned']} expired PINs and {result['changes_cleaned']} pending changes")
|
|
except Exception as e:
|
|
print(f"Error during cleanup: {e}") |