bot: fix crash when trying to send a too long msg
This commit is contained in:
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}")
|
||||||
|
try:
|
||||||
if message.startswith("/me "):
|
if message.startswith("/me "):
|
||||||
self.connection.action(target, message[4:])
|
self.connection.action(target, message[4:])
|
||||||
else:
|
else:
|
||||||
self.connection.privmsg(target, message)
|
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…
Reference in a new issue