From d223009c6ec039011cd8a9900cf3709e5c49f7e1 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 9 Feb 2020 00:04:12 +0000 Subject: [PATCH] support bot-wide message filters too (!bfilter) --- modules/message_filter.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/message_filter.py b/modules/message_filter.py index f04f17a0..3dd63058 100644 --- a/modules/message_filter.py +++ b/modules/message_filter.py @@ -28,7 +28,8 @@ class Module(ModuleManager.BaseModule): return out def _get_filters(self, server, target): - filters = server.get_setting("message-filters", []) + filters = self.bot.get_setting("message-filters", []) + filters.extend(server.get_setting("message-filters", [])) filters.extend(target.get_setting("message-filters", [])) return list(set(filters)) @@ -65,6 +66,7 @@ class Module(ModuleManager.BaseModule): @utils.hook("received.command.cfilter", channel_only=True) @utils.hook("received.command.filter") + @utils.hook("received.command.bfilter") @utils.kwarg("help", "Add a message filter for the current channel") @utils.kwarg("permissions", "cfilter") @utils.spec("!'list ?int") @@ -77,6 +79,8 @@ class Module(ModuleManager.BaseModule): if event["command"] == "cfilter": target = event["target"] + elif event["command"] == "bfilter": + target = self.bot else: target = event["server"] filters = target.get_setting("message-filters", [])