diff options
| author | 2018-08-31 10:50:37 +0100 | |
|---|---|---|
| committer | 2018-08-31 10:50:37 +0100 | |
| commit | abed9cf4ea71dcbad2dd2c049683b8d14b942e09 (patch) | |
| tree | 3e40caf63fa7e1500469f4ad9a0c45c51808aad4 /modules/karma.py | |
| parent | Fix a copy paste fail in IRCLineHandler that caused PARTs to be handled as QUITs (diff) | |
| signature | ||
Reformat
Diffstat (limited to 'modules/karma.py')
| -rw-r--r-- | modules/karma.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/modules/karma.py b/modules/karma.py index e92b2c60..20b64b49 100644 --- a/modules/karma.py +++ b/modules/karma.py @@ -4,6 +4,7 @@ import Utils REGEX_KARMA = re.compile("(.*)(\+{2,}|\-{2,})$") KARMA_DELAY_SECONDS = 3 + class Module(object): def __init__(self, bot): self.bot = bot @@ -20,8 +21,8 @@ class Module(object): bot.events.on("postboot").on("configure").on( "channelset").assure_call(setting="karma-verbose", - help="Disable/Enable automatically responding to karma changes", - validate=Utils.bool_or_none) + help="Disable/Enable automatically responding to karma changes", + validate=Utils.bool_or_none) def new_user(self, event): event["user"].last_karma = None @@ -30,8 +31,8 @@ class Module(object): match = re.match(REGEX_KARMA, event["message"].strip()) if match and not event["action"]: verbose = event["channel"].get_setting("karma-verbose", False) - if not event["user"].last_karma or (time.time()-event["user" - ].last_karma) >= KARMA_DELAY_SECONDS: + if not event["user"].last_karma or (time.time() - event["user" + ].last_karma) >= KARMA_DELAY_SECONDS: target = match.group(1).lower().strip() if not target == event["user"].name and target: positive = match.group(2)[0] == "+" @@ -52,10 +53,13 @@ class Module(object): event["user"].last_karma = time.time() elif verbose: if target: - self.bot.events.on("send").on("stderr").call(module_name="Karma", - target=event["channel"], message="You cannot change your own karma") + self.bot.events.on("send").on("stderr").call( + module_name="Karma", + target=event["channel"], + message="You cannot change your own karma") elif verbose: event["stderr"].write("Try again in a couple of seconds") + def karma(self, event): if event["args"]: target = event["args"] |
