Skip to content

Commit

Permalink
Changed for-if loop to any-map.
Browse files Browse the repository at this point in the history
  • Loading branch information
Patchwork Collective committed Oct 20, 2021
1 parent d607d84 commit 9729d95
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 @@ -318,10 +318,7 @@ async def __call__(self, ctx: tanjun_abc.Context, /) -> bool:

member_roles = ctx.member.get_roles()

for member_role in member_roles:
if self.check_roles(member_role):
return self._handle_result(True)
return self._handle_result(False)
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:
Expand Down

0 comments on commit 9729d95

Please sign in to comment.