DrBotIRC: bring reply() back to the base server, for use in alias

This commit is contained in:
Brian S. Stephan 2012-07-10 17:18:35 -05:00
parent 395d436008
commit d50b0867e8
1 changed files with 19 additions and 0 deletions

View File

@ -384,6 +384,25 @@ class DrBotIRC(irclib.IRC):
self._xmlrpc_shutdown()
sys.exit()
def reply(self, connection, event, replystr, stop_responding=False):
"""Reply over IRC to replypath or return a string with the reply."""
replypath = event.target()
# check for privmsg
if replypath == connection.get_nickname():
replypath = irclib.nm_to_n(event.source())
if replystr is not None:
if event._recursing:
return replystr
else:
replies = replystr.split('\n')
for reply in replies:
connection.privmsg(replypath, reply)
if stop_responding:
return "NO MORE"
def save_modules(self):
for module in self.modlist:
module.save()