diff --git a/packages/spike/src/discord/events.ts b/packages/spike/src/discord/events.ts index e10ba62..52322b0 100644 --- a/packages/spike/src/discord/events.ts +++ b/packages/spike/src/discord/events.ts @@ -11,7 +11,14 @@ export const listenForEvents = (client: Client) => { if (!msg.guild || msg.mentions.has(client.user!)) { const response = await respondToUserMessage(msg) if (response) { - await msg.channel.send(response) + if (response.length > 2000) { + const chunks = response.match(/.{1,2000}/g) || [] // Discord has a 2000 character limit, so we need to split the response + for (const chunk of chunks) { + await msg.channel.send(chunk) + } + } else { + await msg.channel.send(response) + } } } } catch (error) {