From 4514f268c2ed6704e2d612b63a9c2359daec0160 Mon Sep 17 00:00:00 2001 From: Aboda7m <50844122+Aboda7m@users.noreply.github.com> Date: Wed, 5 Jun 2024 07:26:49 +0300 Subject: [PATCH] Update queue.js (#21) fixed error when the queue message exceeds discord's 4000 character limit --- commands/queue.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/commands/queue.js b/commands/queue.js index 5ef21fc..eb89a51 100644 --- a/commands/queue.js +++ b/commands/queue.js @@ -7,6 +7,18 @@ module.exports = { const q = queue.songs .map((song, i) => `${i === 0 ? 'Playing:' : `${i}.`} ${song.name} - \`${song.formattedDuration}\``) .join('\n') - message.channel.send(`${client.emotes.queue} | **Server Queue**\n${q}`) + //message.channel.send(`${client.emotes.queue} | **Server Queue**\n${q}`) + var str = `${client.emotes.queue} | **Server Queue**\n${q}`; + var partsArr = str.match(/[\s\S]{1,1900}/g) || []; + if (partsArr.length > 1) { + partsArr.forEach((partsArr, i) => message.channel.send(`${partsArr} \nPart ${i + 1} / ${partsArr.length}`)); + } + else { + message.channel.send(`${client.emotes.queue} | **Server Queue**\n${q}`); + } + + + + } }