Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[utils] Prevent is_staff from erroring if roles are None #496

Closed
wants to merge 2 commits into from

Conversation

imtherealF1
Copy link
Contributor

resolves #485

roles = settings.admin_role_ids + settings.root_role_ids
if any(role.id in roles for role in interaction.user.roles): # type: ignore
return True
if isinstance(interaction.user, discord.Member):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check isn't enough, from my understanding the issue is that roles returned by the API are None, if the base type of the user was discord.User to begin with, then the attribute roles wouldn't exist at all. I am pretty confident that all users we are dealing with are always discord.Member objects, so instead you need to filter out the items from member.roles that are empty

@imtherealF1
Copy link
Contributor Author

closing, as it was a ballsdex issue only, and this wont fix it

@imtherealF1 imtherealF1 deleted the improve-isstaff branch January 24, 2025 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

is_staff check can error when roles are None
2 participants