Implement secure team builder with PIN verification system

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
megaproxy 2025-07-14 17:08:02 +01:00
parent 3098be7f36
commit 9cf2231a03
6 changed files with 476 additions and 16 deletions

View file

@ -9,6 +9,7 @@ from .achievements import Achievements
from .admin import Admin
from .inventory import Inventory
from .gym_battles import GymBattles
from .team_builder import TeamBuilder
__all__ = [
'CoreCommands',
@ -18,5 +19,6 @@ __all__ = [
'Achievements',
'Admin',
'Inventory',
'GymBattles'
'GymBattles',
'TeamBuilder'
]

35
modules/team_builder.py Normal file
View file

@ -0,0 +1,35 @@
#!/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}")