Fix injury commands failing to find certain players
Changed /injury roll, /injury set-new, and /injury clear to use search_players() instead of get_players_by_name(). The /players?name= API endpoint fails to find some players (e.g., Gunnar Henderson) while the /players/search?q= endpoint works correctly. This fixes the "Player Not Found" error when users try to clear injuries for players that exist in the database. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
a056dced5c
commit
4bdfe3ee0a
@ -73,8 +73,8 @@ class InjuryGroup(app_commands.Group):
|
||||
if not current:
|
||||
raise BotException("Failed to get current season information")
|
||||
|
||||
# Search for player
|
||||
players = await player_service.get_players_by_name(player_name, current.season)
|
||||
# Search for player using the search endpoint (more reliable than name param)
|
||||
players = await player_service.search_players(player_name, limit=10, season=current.season)
|
||||
|
||||
if not players:
|
||||
embed = EmbedTemplate.error(
|
||||
@ -389,8 +389,8 @@ class InjuryGroup(app_commands.Group):
|
||||
if not current:
|
||||
raise BotException("Failed to get current season information")
|
||||
|
||||
# Search for player
|
||||
players = await player_service.get_players_by_name(player_name, current.season)
|
||||
# Search for player using the search endpoint (more reliable than name param)
|
||||
players = await player_service.search_players(player_name, limit=10, season=current.season)
|
||||
|
||||
if not players:
|
||||
embed = EmbedTemplate.error(
|
||||
@ -570,8 +570,8 @@ class InjuryGroup(app_commands.Group):
|
||||
if not current:
|
||||
raise BotException("Failed to get current season information")
|
||||
|
||||
# Search for player
|
||||
players = await player_service.get_players_by_name(player_name, current.season)
|
||||
# Search for player using the search endpoint (more reliable than name param)
|
||||
players = await player_service.search_players(player_name, limit=10, season=current.season)
|
||||
|
||||
if not players:
|
||||
embed = EmbedTemplate.error(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user