hotfix for message too long
parent
23f5c76f13
commit
76dba086b3
|
@ -248,14 +248,18 @@ class Bot(irc.bot.SingleServerIRCBot):
|
||||||
if not output.msg:
|
if not output.msg:
|
||||||
return
|
return
|
||||||
for msg in output.msg:
|
for msg in output.msg:
|
||||||
if len(msg.encode('UTF-8')) > 512:
|
if output.msg_type == pinhook.plugin.OutputType.Message:
|
||||||
self.logger.error('output message too long: {}'.format(msg))
|
|
||||||
elif output.msg_type == pinhook.plugin.OutputType.Message:
|
|
||||||
self.logger.debug('output message: {}'.format(msg))
|
self.logger.debug('output message: {}'.format(msg))
|
||||||
|
try:
|
||||||
c.privmsg(chan, msg)
|
c.privmsg(chan, msg)
|
||||||
|
except c.MessageTooLong:
|
||||||
|
self.logger.error('output message too long: {}'.format(msg))
|
||||||
elif output.msg_type == pinhook.plugin.OutputType.Action:
|
elif output.msg_type == pinhook.plugin.OutputType.Action:
|
||||||
self.logger.debug('output action: {}'.format(msg))
|
self.logger.debug('output action: {}'.format(msg))
|
||||||
|
try:
|
||||||
c.action(chan, msg)
|
c.action(chan, msg)
|
||||||
|
except c.MessageTooLong:
|
||||||
|
self.logger.error('output message too long: {}'.format(msg))
|
||||||
else:
|
else:
|
||||||
self.logger.warning("Unsupported output type '{}'".format(output.msg_type))
|
self.logger.warning("Unsupported output type '{}'".format(output.msg_type))
|
||||||
time.sleep(.5)
|
time.sleep(.5)
|
||||||
|
|
Loading…
Reference in New Issue