Remove \!swap command and redirect pet management to web interface

- Removed \!swap command as team management moved to website
- Added redirect messages pointing users to team builder web interface
- Streamlined pet management workflow through unified web experience
- Maintained existing \!pets command functionality with web redirect

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
megaproxy 2025-07-15 16:58:35 +01:00
parent d05b2ead53
commit ac655b07e6

View file

@ -7,7 +7,7 @@ class PetManagement(BaseModule):
"""Handles team, pets, and future pet management commands""" """Handles team, pets, and future pet management commands"""
def get_commands(self): def get_commands(self):
return ["team", "pets", "activate", "deactivate", "swap", "nickname"] return ["team", "pets", "activate", "deactivate", "nickname"]
async def handle_command(self, channel, nickname, command, args): async def handle_command(self, channel, nickname, command, args):
if command == "team": if command == "team":
@ -18,8 +18,6 @@ class PetManagement(BaseModule):
await self.cmd_activate(channel, nickname, args) await self.cmd_activate(channel, nickname, args)
elif command == "deactivate": elif command == "deactivate":
await self.cmd_deactivate(channel, nickname, args) await self.cmd_deactivate(channel, nickname, args)
elif command == "swap":
await self.cmd_swap(channel, nickname, args)
elif command == "nickname": elif command == "nickname":
await self.cmd_nickname(channel, nickname, args) await self.cmd_nickname(channel, nickname, args)
@ -40,7 +38,7 @@ class PetManagement(BaseModule):
team_info = [] team_info = []
# Active pets with star # Active pets with star and team position
for pet in active_pets: for pet in active_pets:
name = pet["nickname"] or pet["species_name"] name = pet["nickname"] or pet["species_name"]
@ -55,7 +53,9 @@ class PetManagement(BaseModule):
else: else:
exp_display = f"{exp_needed} to next" exp_display = f"{exp_needed} to next"
team_info.append(f"{name} (Lv.{pet['level']}) - {pet['hp']}/{pet['max_hp']} HP | EXP: {exp_display}") # Show team position
position = pet.get("team_order", "?")
team_info.append(f"[{position}]⭐{name} (Lv.{pet['level']}) - {pet['hp']}/{pet['max_hp']} HP | EXP: {exp_display}")
# Inactive pets # Inactive pets
for pet in inactive_pets[:5]: # Show max 5 inactive for pet in inactive_pets[:5]: # Show max 5 inactive
@ -66,6 +66,7 @@ class PetManagement(BaseModule):
team_info.append(f"... and {len(inactive_pets) - 5} more in storage") team_info.append(f"... and {len(inactive_pets) - 5} more in storage")
self.send_message(channel, f"🐾 {nickname}'s team: " + " | ".join(team_info)) self.send_message(channel, f"🐾 {nickname}'s team: " + " | ".join(team_info))
self.send_message(channel, f"🌐 View detailed pet collection at: http://petz.rdx4.com/player/{nickname}#pets")
async def cmd_pets(self, channel, nickname): async def cmd_pets(self, channel, nickname):
"""Show link to pet collection web page""" """Show link to pet collection web page"""
@ -74,7 +75,7 @@ class PetManagement(BaseModule):
return return
# Send URL to player's profile page instead of PM spam # Send URL to player's profile page instead of PM spam
self.send_message(channel, f"{nickname}: View your complete pet collection at: http://petz.rdx4.com/player/{nickname}") self.send_message(channel, f"{nickname}: View your complete pet collection at: http://petz.rdx4.com/player/{nickname}#pets")
async def cmd_activate(self, channel, nickname, args): async def cmd_activate(self, channel, nickname, args):
"""Activate a pet for battle (PM only)""" """Activate a pet for battle (PM only)"""
@ -94,7 +95,8 @@ class PetManagement(BaseModule):
if result["success"]: if result["success"]:
pet = result["pet"] pet = result["pet"]
display_name = pet["nickname"] or pet["species_name"] display_name = pet["nickname"] or pet["species_name"]
self.send_pm(nickname, f"{display_name} is now active for battle!") position = result.get("team_position", "?")
self.send_pm(nickname, f"{display_name} is now active for battle! Team position: {position}")
self.send_message(channel, f"{nickname}: Pet activated successfully!") self.send_message(channel, f"{nickname}: Pet activated successfully!")
else: else:
self.send_pm(nickname, f"{result['error']}") self.send_pm(nickname, f"{result['error']}")
@ -124,44 +126,6 @@ class PetManagement(BaseModule):
self.send_pm(nickname, f"{result['error']}") self.send_pm(nickname, f"{result['error']}")
self.send_message(channel, f"{nickname}: Pet deactivation failed - check PM for details!") self.send_message(channel, f"{nickname}: Pet deactivation failed - check PM for details!")
async def cmd_swap(self, channel, nickname, args):
"""Swap active/storage status of two pets (PM only)"""
# Redirect to PM for privacy
if len(args) < 2:
self.send_pm(nickname, "Usage: !swap <pet1> <pet2>")
self.send_pm(nickname, "Example: !swap Flamey Aqua")
self.send_message(channel, f"{nickname}: Pet swap instructions sent via PM!")
return
player = await self.require_player(channel, nickname)
if not player:
return
# Handle multi-word pet names by splitting on first space vs last space
if len(args) == 2:
pet1_name, pet2_name = args
else:
# For more complex parsing, assume equal split
mid_point = len(args) // 2
pet1_name = " ".join(args[:mid_point])
pet2_name = " ".join(args[mid_point:])
result = await self.database.swap_pets(player["id"], pet1_name, pet2_name)
if result["success"]:
pet1 = result["pet1"]
pet2 = result["pet2"]
pet1_display = pet1["nickname"] or pet1["species_name"]
pet2_display = pet2["nickname"] or pet2["species_name"]
self.send_pm(nickname, f"🔄 Swap complete!")
self.send_pm(nickname, f"{pet1_display}{result['pet1_now']}")
self.send_pm(nickname, f"{pet2_display}{result['pet2_now']}")
self.send_message(channel, f"{nickname}: Pet swap completed!")
else:
self.send_pm(nickname, f"{result['error']}")
self.send_message(channel, f"{nickname}: Pet swap failed - check PM for details!")
async def cmd_nickname(self, channel, nickname, args): async def cmd_nickname(self, channel, nickname, args):
"""Set a nickname for a pet""" """Set a nickname for a pet"""
if len(args) < 2: if len(args) < 2: