diff options
| author | 2019-09-14 20:49:48 +0200 | |
|---|---|---|
| committer | 2019-09-14 20:49:48 +0200 | |
| commit | 4178973a5bc53a584ea31540ecf6638f0e8307fc (patch) | |
| tree | da699f7566db282f9d8c99b57aeae3675b0b8583 | |
| parent | Improve handling of long deleted messsages (diff) | |
Fixes a sneaky genexp exhaustion bug in @without_role.
This problem made the decorator only check the first role that was
passed into it, instead of checking all the roles. In other words,
the check would fail on *STAFF_ROLES unless you had the Helpers role.
Solved by refactoring the genexp to a listcomp.
| -rw-r--r-- | bot/utils/checks.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/bot/utils/checks.py b/bot/utils/checks.py index 37dc657f7..195edab0f 100644 --- a/bot/utils/checks.py +++ b/bot/utils/checks.py @@ -37,7 +37,7 @@ def without_role_check(ctx: Context, *role_ids: int) -> bool: "This command is restricted by the without_role decorator. Rejecting request.") return False - author_roles = (role.id for role in ctx.author.roles) + author_roles = [role.id for role in ctx.author.roles] check = all(role not in author_roles for role in role_ids) log.trace(f"{ctx.author} tried to call the '{ctx.command.name}' command. " f"The result of the without_role check was {check}.") |