fix chunking
This commit is contained in:
parent
ad6a359ac7
commit
2d4f3e91a6
1 changed files with 4 additions and 1 deletions
5
index.js
5
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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue