Repository navigation
IRC: Error sending messages bigger than 512 bytes. #989
Description
In order to let us help you better, please fill out the following fields as best you can:
I am...
- Reporting a bug
- Suggesting a new feature
- Requesting help with running my bot
- Requesting help writing plugins
- Here about something else
I am running...
- Errbot version: 4.3.7
- OS version: Fedora 25
- Python version: 3.5
- Using a virtual environment: yes
Issue description
If the response of the bot has more than 512 bytes there is some complain from the backend:
Computer says nooo. See logs for details:
Messages limited to 512 bytes including CR/LF
Full backtrace from the log:
2017-04-11 21:01:27,355 ERROR errbot.core An error happened while processing a message ("gary test"): Traceback (most recent call last):
File "/home/qlixed/src/gary/lib/python3.5/site-packages/errbot/core.py", line 453, in _execute_and_send
self.send_simple_reply(mess, self.process_template(template_name, reply), private)
File "/home/qlixed/src/gary/lib/python3.5/site-packages/errbot/core.py", line 198, in send_simple_reply
self.split_and_send_message(reply)
File "/home/qlixed/src/gary/lib/python3.5/site-packages/errbot/core.py", line 163, in split_and_send_message
self.send_message(partial_message)
File "/home/qlixed/src/gary/lib/python3.5/site-packages/errbot/backends/irc.py", line 672, in send_message
msg_func(msg_to, line)
File "/home/qlixed/src/gary/lib/python3.5/site-packages/errbot/utils.py", line 235, in rate_limited_function
ret = func(*args, **kargs)
File "/home/qlixed/src/gary/lib/python3.5/site-packages/errbot/backends/irc.py", line 426, in send_private_message
self.connection.privmsg(to, line)
File "/home/qlixed/src/gary/lib/python3.5/site-packages/irc/client.py", line 885, in privmsg
self.send_raw("PRIVMSG %s :%s" % (target, text))
File "/home/qlixed/src/gary/lib/python3.5/site-packages/irc/client.py", line 921, in send_raw
sender(self._prep_message(string))
File "/home/qlixed/src/gary/lib/python3.5/site-packages/irc/client.py", line 909, in _prep_message
raise MessageTooLong(msg)
irc.client.MessageTooLong: Messages limited to 512 bytes including CR/LF
"
Traceback (most recent call last):
File "/home/qlixed/src/gary/lib/python3.5/site-packages/errbot/core.py", line 453, in _execute_and_send
self.send_simple_reply(mess, self.process_template(template_name, reply), private)
File "/home/qlixed/src/gary/lib/python3.5/site-packages/errbot/core.py", line 198, in send_simple_reply
self.split_and_send_message(reply)
File "/home/qlixed/src/gary/lib/python3.5/site-packages/errbot/core.py", line 163, in split_and_send_message
self.send_message(partial_message)
File "/home/qlixed/src/gary/lib/python3.5/site-packages/errbot/backends/irc.py", line 672, in send_message
msg_func(msg_to, line)
File "/home/qlixed/src/gary/lib/python3.5/site-packages/errbot/utils.py", line 235, in rate_limited_function
ret = func(*args, **kargs)
File "/home/qlixed/src/gary/lib/python3.5/site-packages/errbot/backends/irc.py", line 426, in send_private_message
self.connection.privmsg(to, line)
File "/home/qlixed/src/gary/lib/python3.5/site-packages/irc/client.py", line 885, in privmsg
self.send_raw("PRIVMSG %s :%s" % (target, text))
File "/home/qlixed/src/gary/lib/python3.5/site-packages/irc/client.py", line 921, in send_raw
sender(self._prep_message(string))
File "/home/qlixed/src/gary/lib/python3.5/site-packages/irc/client.py", line 909, in _prep_message
raise MessageTooLong(msg)
irc.client.MessageTooLong: Messages limited to 512 bytes including CR/LF
Steps to reproduce
Make any response from the bot with a string with len()>512
Additional info
It suppose to cut the message in 510 bytes chunks when call self.split_and_send_message, but apparently is not working.
Activity
irc: Fix maximal message length
mrshu commentedon Jul 9, 2017
@qlixed While the
split_and_sent_messagewas working as intended, the maximum length of the actual message that can be sent via IRC is also limited by the length of the nick/channel which it is addressed to, and so the previous implementation was not working as one may have expected it to.If you have some time, it would be very helpful if you could check whether the fix I put together in #1063 works for you.