From bfc52fbe8570cde54e0b7144beb3e1270a585e9c Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Fri, 10 Oct 2025 17:58:21 -0700 Subject: [PATCH] feat: okay i hate the multiple messages, lets chunk instead --- src/modules/sendAiResponse.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/modules/sendAiResponse.ts b/src/modules/sendAiResponse.ts index a3c627f..4a9369a 100644 --- a/src/modules/sendAiResponse.ts +++ b/src/modules/sendAiResponse.ts @@ -19,9 +19,17 @@ export const sendAiResponse = async( send: GuildTextBasedChannel["send"] | DMChannel["send"] | Message["reply"], type: GuildTextBasedChannel["sendTyping"], ): Promise => { - for (const line of content) { - await send(line); - await type(); - await sleep(2500); + const joined = content.join("\n\n"); + if (joined.length < 4000) { + await send(joined); + return; + } + const chunks = joined.match(/[\S\s]{1,4000}/g); + if (chunks) { + for (const chunk of chunks) { + await send(chunk); + await type(); + await sleep(2500); + } } };