From c5785a2d1484a98616b0fb8b5a7cb728eb094435 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 26 Jun 2019 14:37:26 +0100 Subject: implement @utils.kwarg() magic, use it for command.regex hooks --- modules/ducks.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'modules/ducks.py') diff --git a/modules/ducks.py b/modules/ducks.py index 6b2f07d6..037c602b 100644 --- a/modules/ducks.py +++ b/modules/ducks.py @@ -1,7 +1,7 @@ #--depends-on commands #--depends-on config -import random, time +import random, re, time from src import EventManager, ModuleManager, utils DUCK = "・゜゜・。。・゜゜\_o< QUACK!" @@ -44,12 +44,12 @@ class Module(ModuleManager.BaseModule): if show_duck: self._trigger_duck(channel) - @utils.hook("command.regex", expect_output=False, ignore_action=False) + @utils.hook("command.regex") + @utils.kwarg("expect_output", False) + @utils.kwarg("ignore_action", False) + @utils.kwarg("command", "duck-trigger") + @utils.kwarg("patern", re.compile(".+")) def channel_message(self, event): - """ - :pattern: .+ - :command: duck-trigger - """ self._activity(event["target"]) def _trigger_duck(self, channel): -- cgit v1.3.1-10-gc9f91