From 7fbb5b282338d9cfe436158937d19b232c395403 Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 10 Sep 2019 12:59:52 +0100 Subject: [PATCH] don't use full event names to check what command we're in --- modules/channel_op.py | 6 +++--- modules/ignore.py | 2 +- modules/karma.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/channel_op.py b/modules/channel_op.py index cb4f32e0..e4a7e8ba 100644 --- a/modules/channel_op.py +++ b/modules/channel_op.py @@ -125,7 +125,7 @@ class Module(ModuleManager.BaseModule): @utils.kwarg("require_access", "op") @utils.kwarg("usage", "[nickname]") def op(self, event): - add = event.name == "received.command.op" + add = event["command"] == "op" target = event["args_split"][0] if event["args"] else event[ "user"].nickname event["target"].send_mode("+o" if add else "-o", target) @@ -137,7 +137,7 @@ class Module(ModuleManager.BaseModule): @utils.kwarg("require_access", "voice") @utils.kwarg("usage", "[nickname]") def voice(self, event): - add = event.name == "received.command.voice" + add = event["command"] == "voice" target = event["args_split"][0] if event["args"] else event[ "user"].nickname event["target"].send_mode("+v" if add else "-v", target) @@ -184,7 +184,7 @@ class Module(ModuleManager.BaseModule): @utils.kwarg("require_access", "mute") @utils.kwarg("help", "Mute a given user") def _mute(self, event): - add = event.name == "received.command.mute" + add = event["command"] == "mute" time, args = self._parse_time(event["args_split"], 1) target_name = args[0] diff --git a/modules/ignore.py b/modules/ignore.py index f46924b1..369c3dcf 100644 --- a/modules/ignore.py +++ b/modules/ignore.py @@ -99,7 +99,7 @@ class Module(ModuleManager.BaseModule): @utils.kwarg("require-mode", "o") @utils.kwarg("require-access", "cignore") def cignore(self, event): - remove = event.name == "received.command.cunignore" + remove = event["command"] == "cunignore" target_user = event["server"].get_user(event["args_split"][0]) is_ignored = event["target"].get_user_setting(target_user.get_id(), diff --git a/modules/karma.py b/modules/karma.py index 27743218..76a70a30 100644 --- a/modules/karma.py +++ b/modules/karma.py @@ -96,7 +96,7 @@ class Module(ModuleManager.BaseModule): @utils.kwarg("min_args", 1) @utils.kwarg("usage", "") def changepoint(self, event): - positive = event.name == "received.command.addpoint" + positive = event["command"] == "addpoint" success, message = self._karma(event["server"], event["user"], event["args"].strip(), positive) event["stdout" if success else "stderr"].write(message)