Closed
Description
There's currently nothing to handle messages which exceed the 2000 character limit.
Ideally the client should:
- split messages over the limit and send them as individual messages
- prefer splits by lines instead of characters to make the messages less awkward to read
- re-wrap code blocks that have been split over messages (preserving the syntax highlighting)
Sample implementation (taken from here):
const MESSAGE_CHAR_LIMIT = 2000;
const splitString = (string, prepend = '', append = '') => {
if (string.length <= MESSAGE_CHAR_LIMIT) {
return [string];
}
const splitIndex = string.lastIndexOf('\n', MESSAGE_CHAR_LIMIT - prepend.length - append.length);
const sliceEnd = splitIndex > 0 ? splitIndex : MESSAGE_CHAR_LIMIT - prepend.length - append.length;
const rest = splitString(string.slice(sliceEnd), prepend, append);
return [`${string.slice(0, sliceEnd)}${append}`, `${prepend}${rest[0]}`, ...rest.slice(1)];
};
Metadata
Metadata
Assignees
Labels
No labels