mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-20 01:19:26 +01:00
MessageParser: Log and skip current regexp on error
This commit is contained in:
parent
91accc0458
commit
850b4c3f69
@ -192,20 +192,23 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
return
|
||||
max_triggers = self.registryValue('maxTriggers', channel, irc.network)
|
||||
for (channel, regexp, action) in results:
|
||||
for match in re.finditer(regexp, msg.args[1]):
|
||||
if match is not None:
|
||||
thisaction = action
|
||||
self._updateRank(irc.network, channel, regexp)
|
||||
for (i, j) in enumerate(match.groups()):
|
||||
if match.group(i+1) is not None:
|
||||
# Need a lambda to prevent re.sub from
|
||||
# interpreting backslashes in the replacement
|
||||
thisaction = re.sub(r'\$' + str(i+1), lambda _: match.group(i+1), thisaction)
|
||||
actions.append((regexp, thisaction))
|
||||
if max_triggers != 0 and max_triggers == len(actions):
|
||||
break
|
||||
if max_triggers != 0 and max_triggers == len(actions):
|
||||
break
|
||||
try:
|
||||
for match in re.finditer(regexp, msg.args[1]):
|
||||
if match is not None:
|
||||
thisaction = action
|
||||
self._updateRank(irc.network, channel, regexp)
|
||||
for (i, j) in enumerate(match.groups()):
|
||||
if match.group(i+1) is not None:
|
||||
# Need a lambda to prevent re.sub from
|
||||
# interpreting backslashes in the replacement
|
||||
thisaction = re.sub(r'\$' + str(i+1), lambda _: match.group(i+1), thisaction)
|
||||
actions.append((regexp, thisaction))
|
||||
if max_triggers != 0 and max_triggers == len(actions):
|
||||
break
|
||||
if max_triggers != 0 and max_triggers == len(actions):
|
||||
break
|
||||
except Exception:
|
||||
self.log.exception('Error while handling %r', regexp)
|
||||
|
||||
|
||||
for (regexp, action) in actions:
|
||||
|
Loading…
Reference in New Issue
Block a user