diff options
| author | 2019-05-06 17:08:56 +0100 | |
|---|---|---|
| committer | 2019-05-06 17:08:56 +0100 | |
| commit | 0114d35d4c7a3a6640b5ccd1190347998b9dc7c5 (patch) | |
| tree | 328cf0f8e8dc291239197ae690f74845b3ba88e0 /modules/commands | |
| parent | Support only saving birthday day and month (diff) | |
| signature | ||
Add a mechanism to ignore specific commands for a whole network
Diffstat (limited to 'modules/commands')
| -rw-r--r-- | modules/commands/__init__.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/modules/commands/__init__.py b/modules/commands/__init__.py index 4315e940..965518d8 100644 --- a/modules/commands/__init__.py +++ b/modules/commands/__init__.py @@ -79,11 +79,13 @@ class Module(ModuleManager.BaseModule): return target.get_setting(COMMAND_METHOD, server.get_setting(COMMAND_METHOD, "PRIVMSG")).upper() - def _is_ignored(self, user, command): + def _is_ignored(self, server, user, command): if user.get_setting("ignore", False): return True elif user.get_setting("ignore-%s" % command, False): return True + elif server.get_setting("ignore-%s" % command, False): + return True return False def message(self, event, command, args_index=1): @@ -364,6 +366,19 @@ class Module(ModuleManager.BaseModule): event["stdout"].write("Removed ignore for '%s'%s" % (user.nickname, for_str)) + @utils.hook("received.command.serverignore", in_args=1) + def server_ignore(self, event): + command = event["args_split"][0].lower() + setting = "ignore-%s" % command + + if event["server"].get_setting(setting): + event["stderr"].write("I'm already ignoring '%s' for %s" % + (command, str(event["server"]))) + else: + server.set_setting(setting, True) + event["stdout"].write("Now ignoring '%s' for %s" % + (command, str(event["server"]))) + @utils.hook("send.stdout") def send_stdout(self, event): stdout = outs.StdOut(event["server"], event["module_name"], |
