diff options
| author | 2018-11-12 22:55:40 +0000 | |
|---|---|---|
| committer | 2018-11-12 22:55:40 +0000 | |
| commit | 49a21b2d365aff51ec437299d8377ad308c8f670 (patch) | |
| tree | bc0249e91a57d2ce7c7311e7f1db8e6dd74a5847 /modules | |
| parent | The target channel of an /INVITE is the second argument! (diff) | |
| signature | ||
Add a way to prevent responses to commands at all in specific channels
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/commands.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/commands.py b/modules/commands.py index 47ef6e05..cb20e7df 100644 --- a/modules/commands.py +++ b/modules/commands.py @@ -91,6 +91,9 @@ def _command_method_validate(s): @utils.export("channelset", {"setting": "hide-prefix", "help": "Disable/enable hiding prefix in command reponses", "validate": utils.bool_or_none}) +@utils.export("channelset", {"setting": "commands", + "help": "Disable/enable responding to commands in-channel", + "validate": utils.bool_or_none}) class Module(ModuleManager.BaseModule): @utils.hook("new.user|channel") def new(self, event): @@ -197,6 +200,10 @@ class Module(ModuleManager.BaseModule): @utils.hook("received.message.channel", priority=EventManager.PRIORITY_LOW) def channel_message(self, event): + commands_enabled = event["channel"].get_setting("commands", True) + if not commands_enabled: + return + command_prefix = event["channel"].get_setting("command-prefix", event["server"].get_setting("command-prefix", "!")) if event["message_split"][0].startswith(command_prefix): |
