feat: okay i hate the multiple messages, lets chunk instead
Node.js CI / Lint and Test (push) Successful in 36s

This commit is contained in:
2025-10-10 17:58:21 -07:00
parent 4300cf0d3f
commit bfc52fbe85
+12 -4
View File
@@ -19,9 +19,17 @@ export const sendAiResponse = async(
send: GuildTextBasedChannel["send"] | DMChannel["send"] | Message["reply"], send: GuildTextBasedChannel["send"] | DMChannel["send"] | Message["reply"],
type: GuildTextBasedChannel["sendTyping"], type: GuildTextBasedChannel["sendTyping"],
): Promise<void> => { ): Promise<void> => {
for (const line of content) { const joined = content.join("\n\n");
await send(line); if (joined.length < 4000) {
await type(); await send(joined);
await sleep(2500); return;
}
const chunks = joined.match(/[\S\s]{1,4000}/g);
if (chunks) {
for (const chunk of chunks) {
await send(chunk);
await type();
await sleep(2500);
}
} }
}; };