diff options
| author | 2019-06-26 14:37:26 +0100 | |
|---|---|---|
| committer | 2019-06-26 14:37:41 +0100 | |
| commit | c5785a2d1484a98616b0fb8b5a7cb728eb094435 (patch) | |
| tree | 470ace2c509805fb9b723592df196b4e9e0edb46 /modules/karma.py | |
| parent | Update IRCBot `except queue.Empty` comment (diff) | |
| signature | ||
implement @utils.kwarg() magic, use it for command.regex hooks
Diffstat (limited to 'modules/karma.py')
| -rw-r--r-- | modules/karma.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/karma.py b/modules/karma.py index 78eebe02..7650e430 100644 --- a/modules/karma.py +++ b/modules/karma.py @@ -8,6 +8,8 @@ from src import EventManager, ModuleManager, utils WORD_STOP = [",", ":"] KARMA_DELAY_SECONDS = 3 +REGEX_KARMA = re.compile(r"^(.*)(\+{2}|\-{2})$") + @utils.export("channelset", {"setting": "karma-verbose", "help": "Enable/disable automatically responding to karma changes", "validate": utils.bool_or_none, "example": "on"}) @@ -28,11 +30,9 @@ class Module(ModuleManager.BaseModule): event["user"].last_karma = None @utils.hook("command.regex") + @utils.kwarg("command", "karma") + @utils.kwarg("pattern", REGEX_KARMA) def channel_message(self, event): - """ - :command: karma - :pattern: ^(.*)(\+{2}|\-{2})$ - """ verbose = event["target"].get_setting("karma-verbose", False) nickname_only = event["server"].get_setting("karma-nickname-only", False) |
