diff --git a/DrBotIRC.py b/DrBotIRC.py index d75e0b3..ffb66d3 100644 --- a/DrBotIRC.py +++ b/DrBotIRC.py @@ -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()