diff options
-rw-r--r-- | bot/utils/checks.py | 6 | ||||
-rw-r--r-- | tests/utils/test_checks.py | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/bot/utils/checks.py b/bot/utils/checks.py index ad892e512..db56c347c 100644 --- a/bot/utils/checks.py +++ b/bot/utils/checks.py @@ -38,9 +38,9 @@ def without_role_check(ctx: Context, *role_ids: int) -> bool: return check -def in_channel_check(ctx: Context, channel_id: int) -> bool: - """Checks if the command was executed inside of the specified channel.""" - check = ctx.channel.id == channel_id +def in_channel_check(ctx: Context, *channel_ids: int) -> bool: + """Checks if the command was executed inside the list of specified channels.""" + check = ctx.channel.id in channel_ids log.trace(f"{ctx.author} tried to call the '{ctx.command.name}' command. " f"The result of the in_channel check was {check}.") return check diff --git a/tests/utils/test_checks.py b/tests/utils/test_checks.py index 7121acebd..ef1144ac9 100644 --- a/tests/utils/test_checks.py +++ b/tests/utils/test_checks.py @@ -57,10 +57,10 @@ def test_without_role_check_without_unwanted_role(context): def test_in_channel_check_for_correct_channel(context): - context.channel.id = 42 - assert checks.in_channel_check(context, context.channel.id) + context.channel.id = [42] + assert checks.in_channel_check(context, *context.channel.id) def test_in_channel_check_for_incorrect_channel(context): - context.channel.id = 42 - assert not checks.in_channel_check(context, context.channel.id + 10) + context.channel.id = [42 + 10] + assert not checks.in_channel_check(context, *context.channel.id) |