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.""" """Send message to target after a slight delay."""
time.sleep(self.config["speak_delay"]) time.sleep(self.config["speak_delay"])
self.log_d(f"Sending to {target}: {message}") self.log_d(f"Sending to {target}: {message}")
if message.startswith("/me "): try:
self.connection.action(target, message[4:]) if message.startswith("/me "):
else: self.connection.action(target, message[4:])
self.connection.privmsg(target, message) 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): def run_plugin_callbacks(self, event):
"""Run appropriate callbacks for each plugin.""" """Run appropriate callbacks for each plugin."""

Loading…
Cancel
Save