lita-slack icon indicating copy to clipboard operation
lita-slack copied to clipboard

Handling large messages

Open benodom opened this issue 9 years ago • 3 comments

This is a continuation of the conversation at: https://github.com/josacar/lita-jobs/issues/3

At the moment, any messages larger than MAX_MESSAGE_BYTES are dropped, with an exception raised: https://github.com/kenjij/lita-slack/blob/master/lib/lita/adapters/slack/rtm_connection.rb#L103

It would be preferred in my humble opinion to auto-convert anything larger than MAX_MESSAGE_BYTES to a Slack text attachment. Chunking a message into 1..n pieces could still fill up a Slack room and be undesirable for users in the channel, whereas the Slack text attachment requires users to click-to-expand.

I'd be happy to submit a PR; thanks for your feedback.

benodom avatar Feb 27 '15 01:02 benodom

I agree, this would be better behavior. Go ahead with a PR if you like, just make sure the code for actually submitting the Slack attachment is isolated from the code that uses it when a large message is encountered, as we'll probably want to introduce a mechanism for explicitly sending Slack attachments in the future and we'll want to reuse that code!

jimmycuadra avatar Feb 27 '15 01:02 jimmycuadra

This should be closed as now in slack we can send attachments, maybe it can be interesting to use this on the send_message when it exceeds the maximum size.

Attachments still crop large messages and they don't throw an exception either.

josacar avatar Oct 13 '15 10:10 josacar

I'm gonna leave it open because the issue is really about that large messages crash the adapter instead of falling back gracefully to an attachment. It's an easier change now that there's support in the adapter for attachments, though.

jimmycuadra avatar Oct 13 '15 11:10 jimmycuadra