mekb-turtle/discord-ai-bot

Discord has a 2,000-character Limit per Message

boneitis opened this issue · 1 comments

It seems that Ollama will be hitting against Discord's message size limit fairly regularly. Could be worth looking into the feasibility of chunking responses over multiple messages.

[Shard #0] [DEBUG] #study-room3 - boneitis-dev: tell me a dirty joke.
[Shard #0] [DEBUG] Response: Why did the chicken cross the road? To prove to the world that chickens can be just as smart as pigs.
[Shard #0] [DEBUG] #study-room3 - boneitis-dev: tell me another, but much more NSFW.
[Shard #0] [DEBUG] Response: Once upon a time there was a little boy who <..snip..original message was about 2800 characters..>
[Shard #0] [ERROR] DiscordAPIError[50035]: Invalid Form Body
content[BASE_TYPE_MAX_LENGTH]: Must be 2000 or fewer in length.
at handleErrors (/home/llamabeast/discord-ai-bot/node_modules/@discordjs/rest/dist/index.js:687:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/home/llamabeast/discord-ai-bot/node_modules/@discordjs/rest/dist/index.js:1072:23)
at async SequentialHandler.queueRequest (/home/llamabeast/discord-ai-bot/node_modules/@discordjs/rest/dist /index.js:913:14)
at async _REST.request (/home/llamabeast/discord-ai-bot/node_modules/@discordjs/rest/dist/index.js:1218:22)
at async TextChannel.send (/home/llamabeast/discord-ai-bot/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:162:15)
at async handleMessage (file:///home/llamabeast/discord-ai-bot/src/bot.js:300:24)
at async Timeout._onTimeout (file:///home/llamabeast/discord-ai-bot/src/bot.js:107:16)

I initially thought of this, but decided against it as I didn't think it would generate a response that large, but never mind