mirror of
https://github.com/musix-org/musix-oss
synced 2024-12-22 21:13:18 +00:00
25 lines
1.0 KiB
JavaScript
25 lines
1.0 KiB
JavaScript
const { EmbedBuilder } = require("discord.js");
|
|
|
|
module.exports = {
|
|
name: 'list',
|
|
async execute(message, args, client, prefix) {
|
|
if (args[2]) {
|
|
if (isNaN(args[2])) return msg.channel.send(':x: I\'m sorry, But you need to enter a valid __number__.');
|
|
}
|
|
let page = parseInt(args[2]);
|
|
if (!page) page = 1;
|
|
let pagetext = `:page_facing_up: Page: ${page} :page_facing_up:`
|
|
let queuesongs = client.global.db.playlists[message.guild.id].songs.slice((page - 1) * 20, page * 20);
|
|
let queuemessage = `${queuesongs.map(song => `**#** ${song.title}`).join('\n')}`
|
|
const hashs = queuemessage.split('**#**').length;
|
|
for (let i = 0; i < hashs; i++) {
|
|
queuemessage = queuemessage.replace('**#**', `**${i + 1}**`);
|
|
}
|
|
const embed = new EmbedBuilder()
|
|
.setTitle("__playlist queue__")
|
|
.setDescription(`${pagetext}\n${queuemessage}`)
|
|
.setColor("#b50002")
|
|
return message.channel.send({ embeds: [embed] });
|
|
}
|
|
};
|