Correctly set nickname-only karma

This commit is contained in:
jesopo 2018-10-02 15:14:34 +01:00
parent c7e4ae6e12
commit a9b0dd331b

View file

@ -39,19 +39,19 @@ class Module(ModuleManager.BaseModule):
setting_target = event["server"] setting_target = event["server"]
if nickname_only: if nickname_only:
user = event["server"].get_user(target) user = event["server"].get_user(target)
setting = target setting = "karma"
setting_target = user setting_target = user
if not event["channel"].has_user(user): if not event["channel"].has_user(user):
return return
positive = match.group(2)[0] == "+" positive = match.group(2)[0] == "+"
karma = event["server"].get_setting(setting, 0) karma = setting_target.get_setting(setting, 0)
karma += 1 if positive else -1 karma += 1 if positive else -1
if karma: if karma:
event["server"].set_setting(setting, karma) setting_target.set_setting(setting, karma)
else: else:
event["server"].del_setting(setting) setting_target.del_setting(setting)
if verbose: if verbose:
self.events.on("send.stdout").call( self.events.on("send.stdout").call(