bot: fix crash when trying to send a too long msg

This commit is contained in:
dece 2021-09-13 09:04:18 +02:00
parent d47748a56a
commit 6256975f90

View file

@ -151,10 +151,13 @@ class Bot(irc.client.SimpleIRCClient, Logger):
"""Send message to target after a slight delay."""
time.sleep(self.config["speak_delay"])
self.log_d(f"Sending to {target}: {message}")
try:
if message.startswith("/me "):
self.connection.action(target, message[4:])
else:
self.connection.privmsg(target, message)
except irc.client.MessageTooLong:
self.log_e("Could not send, message is too long.")
def run_plugin_callbacks(self, event):
"""Run appropriate callbacks for each plugin."""