fix: Implement owner check for eval command using a dedicated function

This commit is contained in:
Slipstream 2025-05-30 16:09:10 -06:00
parent a818e30702
commit 4579d5f9c8
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -114,8 +114,12 @@ class EvalCog(commands.Cog):
else:
await ctx.send(f'```py\n{value}{ret}\n```')
async def is_owner_check(interaction: discord.Interaction) -> bool:
"""Checks if the interacting user is the bot owner."""
return interaction.user.id == interaction.client.owner_id
@app_commands.command(name="eval", description="Evaluate Python code using a modal form.")
@app_commands.is_owner()
@app_commands.check(is_owner_check)
async def eval_slash(self, interaction: discord.Interaction):
"""Opens a modal to evaluate Python code."""
await interaction.response.send_modal(EvalModal())