Skip to content

Commit

Permalink
Update queue.js (#21)
Browse files Browse the repository at this point in the history
fixed error when the queue message exceeds discord's 4000 character limit
  • Loading branch information
Aboda7m authored Jun 5, 2024
1 parent 778d7e4 commit 4514f26
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion commands/queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}




}
}

0 comments on commit 4514f26

Please sign in to comment.