From 2d4f3e91a6f203a387f7ea3b7c749ba75d758f5c Mon Sep 17 00:00:00 2001 From: Eri Date: Thu, 14 Aug 2025 19:46:30 +0200 Subject: [PATCH] fix chunking --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index abb92de..4edb71f 100644 --- a/index.js +++ b/index.js @@ -206,7 +206,10 @@ client.on(Events.MessageCreate, async (message) => { const response = await generateResponse(prompt, username, messageHistory); if (response.length > 2000) { - const chunks = response.match(/.{1,1900}/g) || [response]; + const chunks = []; + for (let i = 0; i < response.length; i += 1900) { + chunks.push(response.slice(i, i + 1900)); + } for (const chunk of chunks) { await message.reply(chunk); }