fix: Implement owner check for eval command using a dedicated function
This commit is contained in:
parent
a818e30702
commit
4579d5f9c8
@ -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())
|
||||
|
Loading…
x
Reference in New Issue
Block a user