fix issue with listeners not sending any output (#58)

pull/60/head
Mal Hancock 2019-02-22 13:39:16 -08:00 committed by GitHub
parent 836a696dc5
commit 81af6ba8bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -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):