From 81af6ba8bd870c353a0be48d188fa51f370b66b1 Mon Sep 17 00:00:00 2001 From: Mal Hancock Date: Fri, 22 Feb 2019 13:39:16 -0800 Subject: [PATCH] fix issue with listeners not sending any output (#58) --- pinhook/bot.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pinhook/bot.py b/pinhook/bot.py index d083a34..19aaa03 100644 --- a/pinhook/bot.py +++ b/pinhook/bot.py @@ -184,7 +184,7 @@ class Bot(irc.bot.SingleServerIRCBot): for lstnr in pinhook.plugin.lstnrs: try: self.logger.debug('whispering to listener: {}'.format(lstnr)) - output = pinhook.plugin.lstnrs[lstnr](self.Message( + listen_output = pinhook.plugin.lstnrs[lstnr](self.Message( channel=chan, text=text, nick_list=nick_list, @@ -196,10 +196,12 @@ class Bot(irc.bot.SingleServerIRCBot): ops=self.ops, logger=self.logger )) - self.logger.debug(output.msg_type) - self.logger.debug(output.msg) + self.logger.debug(listen_output.msg) + if listen_output: + output = listen_output except Exception as e: self.logger.exception('issue with listener {}'.format(lstnr)) + self.logger.debug(f'returning output: {output.msg}') return output def process_event(self, c, e): @@ -237,6 +239,7 @@ class Bot(irc.bot.SingleServerIRCBot): } output = self.call_plugins(**plugin_info) if output: + self.logger.debug(f'sending output: {output.msg}') self.process_output(c, chan, output) def process_output(self, c, chan, output):