fix: Update opponent parameter type from discord.Member to discord.User in game callbacks

This commit is contained in:
Slipstream 2025-05-19 15:00:44 -06:00
parent 223a06450e
commit 2844dcbcd8
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -251,7 +251,7 @@ class GamesCog(commands.Cog, name="Games"):
f"{result}"
)
async def games_rpschallenge_callback(self, interaction: discord.Interaction, opponent: discord.Member):
async def games_rpschallenge_callback(self, interaction: discord.Interaction, opponent: discord.User):
"""Callback for /games rpschallenge command"""
initiator = interaction.user
@ -313,7 +313,7 @@ class GamesCog(commands.Cog, name="Games"):
view.message = await interaction.original_response()
# TicTacToe group callbacks
async def games_tictactoe_callback(self, interaction: discord.Interaction, opponent: discord.Member):
async def games_tictactoe_callback(self, interaction: discord.Interaction, opponent: discord.User):
"""Callback for /games tictactoe play command"""
initiator = interaction.user
@ -366,7 +366,7 @@ class GamesCog(commands.Cog, name="Games"):
view.message = await interaction.original_response()
# Chess group callbacks
async def games_chess_callback(self, interaction: discord.Interaction, opponent: discord.Member):
async def games_chess_callback(self, interaction: discord.Interaction, opponent: discord.User):
"""Callback for /games chess play command"""
initiator = interaction.user
@ -444,7 +444,7 @@ class GamesCog(commands.Cog, name="Games"):
# Don't await this, let it run in the background
asyncio.create_task(view.make_bot_move())
async def games_loadchess_callback(self, interaction: discord.Interaction, state: str, turn: Optional[app_commands.Choice[str]] = None, opponent: Optional[discord.Member] = None, color: Optional[app_commands.Choice[str]] = None, skill_level: int = 10, think_time: float = 1.0):
async def games_loadchess_callback(self, interaction: discord.Interaction, state: str, turn: Optional[app_commands.Choice[str]] = None, opponent: Optional[discord.User] = None, color: Optional[app_commands.Choice[str]] = None, skill_level: int = 10, think_time: float = 1.0):
"""Callback for /games chess load command"""
await interaction.response.defer()
initiator = interaction.user
@ -582,7 +582,7 @@ class GamesCog(commands.Cog, name="Games"):
@app_commands.describe(
opponent="The user you want to challenge."
)
async def coinflipbet(self, interaction: discord.Interaction, opponent: discord.Member):
async def coinflipbet(self, interaction: discord.Interaction, opponent: discord.User):
"""Initiates a coin flip game against another user."""
initiator = interaction.user
@ -637,7 +637,7 @@ class GamesCog(commands.Cog, name="Games"):
@app_commands.command(name="rpschallenge", description="Challenge another user to a game of Rock-Paper-Scissors.")
@app_commands.describe(opponent="The user you want to challenge.")
async def rpschallenge(self, interaction: discord.Interaction, opponent: discord.Member):
async def rpschallenge(self, interaction: discord.Interaction, opponent: discord.User):
"""Starts a Rock-Paper-Scissors game with another user."""
initiator = interaction.user
@ -679,7 +679,7 @@ class GamesCog(commands.Cog, name="Games"):
@app_commands.command(name="tictactoe", description="Challenge another user to a game of Tic-Tac-Toe.")
@app_commands.describe(opponent="The user you want to challenge.")
async def tictactoe(self, interaction: discord.Interaction, opponent: discord.Member):
async def tictactoe(self, interaction: discord.Interaction, opponent: discord.User):
"""Starts a Tic-Tac-Toe game with another user."""
initiator = interaction.user
@ -740,7 +740,7 @@ class GamesCog(commands.Cog, name="Games"):
@app_commands.command(name="chess", description="Challenge another user to a game of chess.")
@app_commands.describe(opponent="The user you want to challenge.")
async def chess(self, interaction: discord.Interaction, opponent: discord.Member):
async def chess(self, interaction: discord.Interaction, opponent: discord.User):
"""Start a game of chess with another user."""
initiator = interaction.user
@ -852,7 +852,7 @@ class GamesCog(commands.Cog, name="Games"):
async def loadchess(self, interaction: discord.Interaction,
state: str,
turn: Optional[app_commands.Choice[str]] = None,
opponent: Optional[discord.Member] = None,
opponent: Optional[discord.User] = None,
color: Optional[app_commands.Choice[str]] = None, # Now required for bot games
skill_level: int = 10,
think_time: float = 1.0):
@ -1010,7 +1010,7 @@ class GamesCog(commands.Cog, name="Games"):
# --- Prefix Commands (Legacy Support) ---
@commands.command(name="coinflipbet", add_to_app_commands=False)
async def coinflipbet_prefix(self, ctx: commands.Context, opponent: discord.Member):
async def coinflipbet_prefix(self, ctx: commands.Context, opponent: discord.User):
"""(Prefix) Challenge another user to a coin flip game."""
initiator = ctx.author
@ -1042,7 +1042,7 @@ class GamesCog(commands.Cog, name="Games"):
await ctx.send(f"🎱 {response}")
@commands.command(name="tictactoe", add_to_app_commands=False)
async def tictactoe_prefix(self, ctx: commands.Context, opponent: discord.Member):
async def tictactoe_prefix(self, ctx: commands.Context, opponent: discord.User):
"""(Prefix) Challenge another user to Tic-Tac-Toe."""
initiator = ctx.author
@ -1092,7 +1092,7 @@ class GamesCog(commands.Cog, name="Games"):
view.message = message
@commands.command(name="rpschallenge", add_to_app_commands=False)
async def rpschallenge_prefix(self, ctx: commands.Context, opponent: discord.Member):
async def rpschallenge_prefix(self, ctx: commands.Context, opponent: discord.User):
"""(Prefix) Challenge another user to Rock-Paper-Scissors."""
initiator = ctx.author
@ -1134,7 +1134,7 @@ class GamesCog(commands.Cog, name="Games"):
)
@commands.command(name="chess", add_to_app_commands=False)
async def chess_prefix(self, ctx: commands.Context, opponent: discord.Member):
async def chess_prefix(self, ctx: commands.Context, opponent: discord.User):
"""(Prefix) Start a game of chess with another user."""
initiator = ctx.author