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

master
dece 3 years ago
parent d47748a56a
commit 6256975f90

@ -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}")
if message.startswith("/me "):
self.connection.action(target, message[4:])
else:
self.connection.privmsg(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."""

Loading…
Cancel
Save