allow for multiple modules to respond to recursion text

This commit is contained in:
Brian S. Stephan 2011-02-17 12:01:32 -06:00
parent f4d69c90d4
commit fca716af9e
1 changed files with 5 additions and 1 deletions

View File

@ -123,11 +123,15 @@ class DrBotIRC(irclib.IRC):
""" """
h = self.handlers h = self.handlers
replies = []
event._target = None event._target = None
for handler in h.get("all_events", []) + h.get(event.eventtype(), []): for handler in h.get("all_events", []) + h.get(event.eventtype(), []):
ret = handler[1](connection, event) ret = handler[1](connection, event)
if ret: if ret:
event.arguments()[0] = ret replies.append(ret)
if len(replies):
event.arguments()[0] = '\n'.join(replies)
def on_pubmsg(self, connection, event): def on_pubmsg(self, connection, event):
"""See if there is an alias ("!command") in the text, and if so, translate it into """See if there is an alias ("!command") in the text, and if so, translate it into