'karma-verbose' -> 'karma-pattern'. don't even parse when false
This commit is contained in:
parent
8081a014ce
commit
e68c5575d1
1 changed files with 12 additions and 12 deletions
|
@ -10,8 +10,8 @@ KARMA_DELAY_SECONDS = 3
|
|||
|
||||
REGEX_KARMA = re.compile(r"^(?:(\S+:) )?(.*)(\+{2}|\-{2})$")
|
||||
|
||||
@utils.export("channelset", utils.BoolSetting("karma-verbose",
|
||||
"Enable/disable automatically responding to karma changes"))
|
||||
@utils.export("channelset", utils.BoolSetting("karma-pattern",
|
||||
"Enable/disable parsing ++/-- karma format"))
|
||||
@utils.export("serverset", utils.BoolSetting("karma-nickname-only",
|
||||
"Enable/disable karma being for nicknames only"))
|
||||
class Module(ModuleManager.BaseModule):
|
||||
|
@ -77,7 +77,8 @@ class Module(ModuleManager.BaseModule):
|
|||
@utils.kwarg("command", "karma")
|
||||
@utils.kwarg("pattern", REGEX_KARMA)
|
||||
def channel_message(self, event):
|
||||
verbose = event["target"].get_setting("karma-verbose", False)
|
||||
pattern = event["target"].get_setting("karma-pattern", False)
|
||||
if pattern:
|
||||
positive = event["match"].group(3)[0] == "+"
|
||||
|
||||
target = event["match"].group(2).strip().rstrip("".join(WORD_STOP))
|
||||
|
@ -88,7 +89,6 @@ class Module(ModuleManager.BaseModule):
|
|||
if target:
|
||||
success, message = self._karma(event["server"], event["user"],
|
||||
target, positive)
|
||||
if verbose:
|
||||
event["stdout" if success else "stderr"].write(message)
|
||||
|
||||
@utils.hook("received.command.addpoint")
|
||||
|
|
Loading…
Reference in a new issue