diff options
author | 2019-12-02 07:38:15 +1000 | |
---|---|---|
committer | 2019-12-02 07:38:15 +1000 | |
commit | e5ea675e78f712ef209af7a1fa10aa99faab736a (patch) | |
tree | 8f8f6abf1690da2ac0bb46a7d0e7bd04cda3d967 | |
parent | Merge pull request #671 from Denayder/master (diff) | |
parent | Allow snekbox in esoteric-python channel (diff) |
Allow snekbox in esoteric-python channel (#675)
Allow snekbox in esoteric-python channel
-rw-r--r-- | bot/cogs/snekbox.py | 2 | ||||
-rw-r--r-- | bot/constants.py | 1 | ||||
-rw-r--r-- | bot/decorators.py | 15 | ||||
-rw-r--r-- | config-default.yml | 1 |
4 files changed, 15 insertions, 4 deletions
diff --git a/bot/cogs/snekbox.py b/bot/cogs/snekbox.py index 362968bd0..55a187ac1 100644 --- a/bot/cogs/snekbox.py +++ b/bot/cogs/snekbox.py @@ -176,7 +176,7 @@ class Snekbox(Cog): @command(name="eval", aliases=("e",)) @guild_only() - @in_channel(Channels.bot, bypass_roles=EVAL_ROLES) + @in_channel(Channels.bot, hidden_channels=(Channels.esoteric,), bypass_roles=EVAL_ROLES) async def eval_command(self, ctx: Context, *, code: str = None) -> None: """ Run Python code and get the results. diff --git a/bot/constants.py b/bot/constants.py index a65c9ffa4..89504a2e0 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -353,6 +353,7 @@ class Channels(metaclass=YAMLGetter): defcon: int devlog: int devtest: int + esoteric: int help_0: int help_1: int help_2: int diff --git a/bot/decorators.py b/bot/decorators.py index 935df4af0..61587f406 100644 --- a/bot/decorators.py +++ b/bot/decorators.py @@ -27,11 +27,20 @@ class InChannelCheckFailure(CheckFailure): super().__init__(f"Sorry, but you may only use this command within {channels_str}.") -def in_channel(*channels: int, bypass_roles: Container[int] = None) -> Callable: - """Checks that the message is in a whitelisted channel or optionally has a bypass role.""" +def in_channel( + *channels: int, + hidden_channels: Container[int] = None, + bypass_roles: Container[int] = None +) -> Callable: + """ + Checks that the message is in a whitelisted channel or optionally has a bypass role. + + Hidden channels are channels which will not be displayed in the InChannelCheckFailure error + message. + """ def predicate(ctx: Context) -> bool: """In-channel checker predicate.""" - if ctx.channel.id in channels: + if ctx.channel.id in channels or ctx.channel.id in hidden_channels: log.debug(f"{ctx.author} tried to call the '{ctx.command.name}' command. " f"The command was used in a whitelisted channel.") return True diff --git a/config-default.yml b/config-default.yml index b2ee1361f..930a1a0e6 100644 --- a/config-default.yml +++ b/config-default.yml @@ -108,6 +108,7 @@ guild: defcon: &DEFCON 464469101889454091 devlog: &DEVLOG 622895325144940554 devtest: &DEVTEST 414574275865870337 + esoteric: 470884583684964352 help_0: 303906576991780866 help_1: 303906556754395136 help_2: 303906514266226689 |