예제 #1
0
파일: management.py 프로젝트: atmishra/bot
 def cog_check(self, ctx: Context) -> bool:
     """Only allow moderators from moderator channels to invoke the commands in this cog."""
     checks = [
         with_role_check(ctx, *constants.MODERATION_ROLES),
         in_channel_check(ctx, *constants.MODERATION_CHANNELS)
     ]
     return all(checks)
예제 #2
0
 def test_in_channel_check_for_incorrect_channel(self):
     self.ctx.channel.id = 42 + 10
     self.assertFalse(checks.in_channel_check(self.ctx, *[42]))
예제 #3
0
 def test_in_channel_check_for_correct_channel(self):
     self.ctx.channel.id = 42
     self.assertTrue(checks.in_channel_check(self.ctx, *[42]))
예제 #4
0
def test_in_channel_check_for_incorrect_channel(context):
    context.channel.id = 42
    assert not checks.in_channel_check(context, context.channel.id + 10)