mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 04:02:46 +01:00
process multiple matches of a regexp per message
This commit is contained in:
parent
95aa56c694
commit
6ceeace44d
@ -134,15 +134,14 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
if len(results) == 0:
|
if len(results) == 0:
|
||||||
return
|
return
|
||||||
for (regexp, action) in results:
|
for (regexp, action) in results:
|
||||||
match = re.search(regexp, msg.args[1])
|
for match in re.finditer(regexp, msg.args[1]):
|
||||||
if match is not None:
|
if match is not None:
|
||||||
self._updateRank(channel, regexp)
|
thisaction = action
|
||||||
for (i, j) in enumerate(match.groups()):
|
self._updateRank(channel, regexp)
|
||||||
action = re.sub(r'\$' + str(i+1), match.group(i+1), action)
|
for (i, j) in enumerate(match.groups()):
|
||||||
actions.append(action)
|
thisaction = re.sub(r'\$' + str(i+1), match.group(i+1), thisaction)
|
||||||
|
actions.append(thisaction)
|
||||||
|
|
||||||
#if len(actions) > 0:
|
|
||||||
# irc.replies(actions, prefixNick=False)
|
|
||||||
for action in actions:
|
for action in actions:
|
||||||
self._runCommandFunction(irc, msg, action)
|
self._runCommandFunction(irc, msg, action)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user