CLAUDE: Fix /reset-image AttributeError by updating owner_only function
The owner_only() function was accessing ctx.author.id, which caused an AttributeError when called with Interaction objects from slash commands (which use .user instead of .author). Updated both utils.py and helpers/utils.py to handle both Context and Interaction objects by checking for .user first, then falling back to .author for backward compatibility with traditional commands. Fixes: Command 'reset-image' raised an exception: AttributeError: 'Interaction' object has no attribute 'author' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
c043948238
commit
c0f9466e54
@ -94,7 +94,10 @@ def owner_only(ctx) -> bool:
|
||||
# ID for discord User Cal
|
||||
owners = [287463767924137994, 1087936030899347516]
|
||||
|
||||
if ctx.author.id in owners:
|
||||
# Handle both Context (has .author) and Interaction (has .user) objects
|
||||
user = getattr(ctx, 'user', None) or getattr(ctx, 'author', None)
|
||||
|
||||
if user and user.id in owners:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
5
utils.py
5
utils.py
@ -91,7 +91,10 @@ def owner_only(ctx) -> bool:
|
||||
# ID for discord User Cal
|
||||
owners = [287463767924137994, 1087936030899347516]
|
||||
|
||||
if ctx.author.id in owners:
|
||||
# Handle both Context (has .author) and Interaction (has .user) objects
|
||||
user = getattr(ctx, 'user', None) or getattr(ctx, 'author', None)
|
||||
|
||||
if user and user.id in owners:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
Loading…
Reference in New Issue
Block a user