From 49a21b2d365aff51ec437299d8377ad308c8f670 Mon Sep 17 00:00:00 2001 From: jesopo Date: Mon, 12 Nov 2018 22:55:40 +0000 Subject: [PATCH] Add a way to prevent responses to commands at all in specific channels --- modules/commands.py | 7 +++++++ 1 file changed, 7 insertions(+) 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):