fix chunking

This commit is contained in:
Eri Ishihara 2025-08-14 19:46:30 +02:00
parent ad6a359ac7
commit 2d4f3e91a6

View file

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