Remove the abuse of looping functions
This commit is contained in:
parent
c7d8735c8a
commit
14fa3b06ff
@ -153,7 +153,12 @@ client.on('messageCreate', async (message) => {
|
|||||||
|
|
||||||
// if we are over the discord char limit we need chunks...
|
// if we are over the discord char limit we need chunks...
|
||||||
if (response.length > limit) {
|
if (response.length > limit) {
|
||||||
|
|
||||||
|
|
||||||
const chunks = response.match(new RegExp(`.{1,${limit}}`, "g"));
|
const chunks = response.match(new RegExp(`.{1,${limit}}`, "g"));
|
||||||
|
if (chunks.length >= 15) return await message.channel.send("Response chunks too large. Try again");
|
||||||
|
|
||||||
|
|
||||||
for (let i = 0; i < chunks.length; i++) {
|
for (let i = 0; i < chunks.length; i++) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
message.channel.send(chunks[i]);
|
message.channel.send(chunks[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user