From df7007efd18501dea8ccb37448b38411fa831bd0 Mon Sep 17 00:00:00 2001 From: Mal Hancock Date: Sat, 6 Oct 2018 17:46:04 -0700 Subject: [PATCH] insert check to log errors for messages over 512 bytes (#29) fixes #24 --- pinhook/bot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pinhook/bot.py b/pinhook/bot.py index 1dd61f6..ac3542b 100644 --- a/pinhook/bot.py +++ b/pinhook/bot.py @@ -220,7 +220,9 @@ class Bot(irc.bot.SingleServerIRCBot): def process_output(self, c, chan, output): for msg in output.msg: - if output.msg_type == 'message': + if len(msg.encode('UTF-8')) > 512: + self.logger.error('output message too long: {}'.format(msg)) + elif output.msg_type == 'message': self.logger.debug('output message: {}'.format(msg)) c.privmsg(chan, msg) elif output.msg_type == 'action':