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); }