Update events.ts
This commit is contained in:
parent
17b7ab3a9d
commit
258dd43e35
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user