From 8acbb5da267a5496571d8381949f2f25d1637563 Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Fri, 30 Sep 2022 14:20:48 +0200 Subject: [PATCH 1/3] add ListMessageSplitter and apply to rules command --- src/ListMessageSplitter.ts | 217 +++++++++++++++++++++++++++++++ src/commands/DumpRulesCommand.ts | 66 ++++++---- 2 files changed, 261 insertions(+), 22 deletions(-) create mode 100644 src/ListMessageSplitter.ts diff --git a/src/ListMessageSplitter.ts b/src/ListMessageSplitter.ts new file mode 100644 index 00000000..4a6da6a1 --- /dev/null +++ b/src/ListMessageSplitter.ts @@ -0,0 +1,217 @@ +import {LogService} from "matrix-bot-sdk"; + +export type MessageSnippet = { html: string, text: string }; + +// The max size a message can be, with 24_000 picked at random to accommodate for overhead. +const OVERHEAD = 24_000 +const MAX_SIZE = 65_536 - OVERHEAD; + +// The extra bits that a