Skip to content

Commit

Permalink
Condensed HasAnyRoles.check_roles into an any() statement.
Browse files Browse the repository at this point in the history
  • Loading branch information
Patchwork Collective committed Oct 20, 2021
1 parent 9729d95 commit 5395052
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions tanjun/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,7 @@ async def __call__(self, ctx: tanjun_abc.Context, /) -> bool:
return self._handle_result(any(map(self.check_roles, member_roles)))

def check_roles(self, member_role: hikari.Role) -> bool:
for check in self.required_roles:
if member_role.id == check or member_role.name == check:
return True
return False
return any(member_role.id == check or member_role.name == check for check in self.required_roles)


@typing.overload
Expand Down

0 comments on commit 5395052

Please sign in to comment.