Some minor cleanup

This commit is contained in:
Noah Pederson 2019-09-27 07:32:09 -06:00
parent f70e46a198
commit c3f95130a3

View file

@ -8,7 +8,7 @@ from src import EventManager, ModuleManager, utils
WORD_STOP = [",", ":"] WORD_STOP = [",", ":"]
KARMA_DELAY_SECONDS = 3 KARMA_DELAY_SECONDS = 3
REGEX_KARMA = re.compile(r'(?:\((.+?)\)|(\S+))(\+\+|--)(\s+|$)') REGEX_KARMA = re.compile(r'(?:\(([^)]+)\)|(\S+))(\+\+|--)(\s+|$)')
@utils.export("channelset", utils.BoolSetting("karma-pattern", @utils.export("channelset", utils.BoolSetting("karma-pattern",
"Enable/disable parsing ++/-- karma format")) "Enable/disable parsing ++/-- karma format"))
@ -84,9 +84,9 @@ class Module(ModuleManager.BaseModule):
# There are two possible match groups, an arbitrary length text inside (), or a single word followed by ++/-- # There are two possible match groups, an arbitrary length text inside (), or a single word followed by ++/--
# group 1 is the former, group 2 is the latter # group 1 is the former, group 2 is the latter
target = event["match"].group(1) if event["match"].group(1) else event["match"].group(2) target = event["match"].group(1) or event["match"].group(2)
target = target.strip().rstrip("".join(WORD_STOP)) # Strips "," " " or ":" from target target = target.strip().rstrip("".join(WORD_STOP)) # Strips "," " " or ":" from target
# if we have a target... # if we have a target...
if target: if target:
success, message = self._karma(event["server"], event["user"], success, message = self._karma(event["server"], event["user"],