diff --git a/modules/base_module.py b/modules/base_module.py index 8a4854d..e539a1a 100644 --- a/modules/base_module.py +++ b/modules/base_module.py @@ -12,6 +12,15 @@ class BaseModule(ABC): self.database = database self.game_engine = game_engine + @staticmethod + def normalize_input(user_input): + """Normalize user input by converting to lowercase for case-insensitive command processing""" + if isinstance(user_input, str): + return user_input.lower() + elif isinstance(user_input, list): + return [item.lower() if isinstance(item, str) else item for item in user_input] + return user_input + @abstractmethod def get_commands(self): """Return list of commands this module handles""" diff --git a/modules/battle_system.py b/modules/battle_system.py index d50abeb..4e3e626 100644 --- a/modules/battle_system.py +++ b/modules/battle_system.py @@ -87,7 +87,7 @@ class BattleSystem(BaseModule): if not player: return - move_name = " ".join(args).title() # Normalize to Title Case + move_name = " ".join(self.normalize_input(args)).title() # Normalize to Title Case result = await self.game_engine.battle_engine.execute_battle_turn(player["id"], move_name) if "error" in result: diff --git a/modules/exploration.py b/modules/exploration.py index 485a292..e4693f4 100644 --- a/modules/exploration.py +++ b/modules/exploration.py @@ -64,7 +64,7 @@ class Exploration(BaseModule): return # Handle various input formats and normalize location names - destination_input = " ".join(args).lower() + destination_input = self.normalize_input(" ".join(args)) # Map common variations to exact location names location_mappings = { @@ -82,7 +82,7 @@ class Exploration(BaseModule): destination = location_mappings.get(destination_input) if not destination: # Fall back to title case if no mapping found - destination = " ".join(args).title() + destination = " ".join(self.normalize_input(args)).title() location = await self.database.get_location_by_name(destination) @@ -171,7 +171,7 @@ class Exploration(BaseModule): if args: # Specific location requested - location_name = " ".join(args).title() + location_name = " ".join(self.normalize_input(args)).title() else: # Default to current location current_location = await self.database.get_player_location(player["id"]) diff --git a/modules/gym_battles.py b/modules/gym_battles.py index 57665c5..00fb7aa 100644 --- a/modules/gym_battles.py +++ b/modules/gym_battles.py @@ -13,13 +13,13 @@ class GymBattles(BaseModule): if command == "gym": if not args: await self.cmd_gym_list(channel, nickname) - elif args[0] == "list": + elif self.normalize_input(args[0]) == "list": await self.cmd_gym_list_all(channel, nickname) - elif args[0] == "challenge": + elif self.normalize_input(args[0]) == "challenge": await self.cmd_gym_challenge(channel, nickname, args[1:]) - elif args[0] == "info": + elif self.normalize_input(args[0]) == "info": await self.cmd_gym_info(channel, nickname, args[1:]) - elif args[0] == "status": + elif self.normalize_input(args[0]) == "status": await self.cmd_gym_status(channel, nickname) else: await self.cmd_gym_list(channel, nickname) @@ -111,7 +111,7 @@ class GymBattles(BaseModule): self.send_message(channel, f"{nickname}: You are not in a valid location! Use !travel to go somewhere first.") return - gym_name = " ".join(args).strip('"') + gym_name = " ".join(self.normalize_input(args)).strip('"') # Look for gym in player's current location (case-insensitive) gym = await self.database.get_gym_by_name_in_location(gym_name, location["id"]) @@ -266,7 +266,7 @@ class GymBattles(BaseModule): if not player: return - gym_name = " ".join(args).strip('"') + gym_name = " ".join(self.normalize_input(args)).strip('"') # First try to find gym in player's current location location = await self.database.get_player_location(player["id"]) diff --git a/modules/inventory.py b/modules/inventory.py index 1fe60ef..3013912 100644 --- a/modules/inventory.py +++ b/modules/inventory.py @@ -72,7 +72,7 @@ class Inventory(BaseModule): if not player: return - item_name = " ".join(args) + item_name = " ".join(self.normalize_input(args)) result = await self.database.use_item(player["id"], item_name) if not result["success"]: diff --git a/modules/pet_management.py b/modules/pet_management.py index 26ffb25..1de0920 100644 --- a/modules/pet_management.py +++ b/modules/pet_management.py @@ -88,7 +88,7 @@ class PetManagement(BaseModule): if not player: return - pet_name = " ".join(args) + pet_name = " ".join(self.normalize_input(args)) result = await self.database.activate_pet(player["id"], pet_name) if result["success"]: @@ -112,7 +112,7 @@ class PetManagement(BaseModule): if not player: return - pet_name = " ".join(args) + pet_name = " ".join(self.normalize_input(args)) result = await self.database.deactivate_pet(player["id"], pet_name) if result["success"]: @@ -174,7 +174,7 @@ class PetManagement(BaseModule): return # Split args into pet identifier and new nickname - pet_identifier = args[0] + pet_identifier = self.normalize_input(args[0]) new_nickname = " ".join(args[1:]) result = await self.database.set_pet_nickname(player["id"], pet_identifier, new_nickname) diff --git a/run_bot_debug.py b/run_bot_debug.py index 5e79860..48cc22b 100644 --- a/run_bot_debug.py +++ b/run_bot_debug.py @@ -303,12 +303,14 @@ class PetBotDebug: self.handle_command(channel, nickname, message) def handle_command(self, channel, nickname, message): + from modules.base_module import BaseModule + command_parts = message[1:].split() if not command_parts: return - command = command_parts[0].lower() - args = command_parts[1:] + command = BaseModule.normalize_input(command_parts[0]) + args = BaseModule.normalize_input(command_parts[1:]) try: if command in self.command_map: diff --git a/webserver.py b/webserver.py index 1d83c2a..374ef0f 100644 --- a/webserver.py +++ b/webserver.py @@ -822,6 +822,32 @@ class PetBotRequestHandler(BaseHTTPRequestHandler): border: 1px solid var(--border-color); }} + .hidden-spawn {{ + display: none; + }} + + .more-button {{ + background: var(--gradient-primary) !important; + color: white !important; + cursor: pointer; + transition: transform 0.2s ease; + }} + + .more-button:hover {{ + transform: scale(1.05); + }} + + .less-button {{ + background: #ff6b6b !important; + color: white !important; + cursor: pointer; + transition: transform 0.2s ease; + }} + + .less-button:hover {{ + transform: scale(1.05); + }} + .info-section {{ background: var(--bg-secondary); border-radius: 15px; @@ -862,6 +888,46 @@ class PetBotRequestHandler(BaseHTTPRequestHandler): 💡 Use !wild <location> in #petz to see what pets spawn in a specific area

+ + """