feat: add is_admin() helper to utils/permissions.py (#55) #64

Merged
cal merged 1 commits from ai/major-domo-v2#55 into next-release 2026-03-09 14:38:08 +00:00

1 Commits

Author SHA1 Message Date
Cal Corum
c41166d53c feat: add is_admin() helper to utils/permissions.py (#55)
Add centralized `is_admin(interaction)` helper that includes the
`isinstance(interaction.user, discord.Member)` guard, preventing
AttributeError in DM contexts.

Use it in `can_edit_player_image()` which previously accessed
`guild_permissions.administrator` directly without the isinstance
guard. Update the corresponding test to mock the user with
`spec=discord.Member` so the isinstance check passes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 09:37:22 -05:00