Bot can try to send messages longer than discord message limit #6

Closed
opened 2023-04-15 22:01:14 +02:00 by Wroclaw · 0 comments
Owner

In rare occasions the OpenAI api can return a message which is longer than 2000 characters (discord limit), thus ending with not sending the message.

It should split the message in multiple parts.

DiscordAPIError[50035]: Invalid Form Body
content[BASE_TYPE_MAX_LENGTH]: Must be 2000 or fewer in length.
    at SequentialHandler.runRequest (C:\Users\Wroclaw\Desktop\gptcord\node_modules\@discordjs\rest\dist\index.js:933:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async SequentialHandler.queueRequest (C:\Users\Wroclaw\Desktop\gptcord\node_modules\@discordjs\rest\dist\index.js:712:14)
    at async REST.request (C:\Users\Wroclaw\Desktop\gptcord\node_modules\@discordjs\rest\dist\index.js:1321:22)
    at async TextChannel.send (C:\Users\Wroclaw\Desktop\gptcord\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:176:15) {rawError: {…}, code: 50035, status: 400, method: 'POST', url: 'https://discord.com/api/v10/channels/649318315768021005/messages', …}```
In rare occasions the OpenAI api can return a message which is longer than 2000 characters (discord limit), thus ending with not sending the message. It should split the message in multiple parts. ``` DiscordAPIError[50035]: Invalid Form Body content[BASE_TYPE_MAX_LENGTH]: Must be 2000 or fewer in length. at SequentialHandler.runRequest (C:\Users\Wroclaw\Desktop\gptcord\node_modules\@discordjs\rest\dist\index.js:933:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async SequentialHandler.queueRequest (C:\Users\Wroclaw\Desktop\gptcord\node_modules\@discordjs\rest\dist\index.js:712:14) at async REST.request (C:\Users\Wroclaw\Desktop\gptcord\node_modules\@discordjs\rest\dist\index.js:1321:22) at async TextChannel.send (C:\Users\Wroclaw\Desktop\gptcord\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:176:15) {rawError: {…}, code: 50035, status: 400, method: 'POST', url: 'https://discord.com/api/v10/channels/649318315768021005/messages', …}```
Wroclaw added the
bug
label 2023-04-15 22:01:14 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Wroclaw/GPTcord#6
No description provided.