Implement case-insensitive command processing across all bot modules
Added normalize_input() function to BaseModule for consistent lowercase conversion of user input. Updated all command modules to use normalization for commands, arguments, pet names, location names, gym names, and item names. Players can now use any capitalization for commands and arguments. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
39ba55832d
commit
8e9ff2960f
8 changed files with 93 additions and 16 deletions
|
|
@ -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"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue