DZ-Musicbot/commands/queue.js

30 lines
957 B
JavaScript
Raw Normal View History

const { getQueue, getCurrentTrack } = require('../utils/queueManager');
2024-08-17 12:10:35 -04:00
const { EmbedBuilder } = require('discord.js');
2024-08-17 11:11:10 -04:00
module.exports = {
name: 'queue',
execute(message) {
const queue = getQueue(message.guild.id);
const currentTrack = getCurrentTrack(message.guild.id);
2024-08-17 12:10:35 -04:00
const embed = new EmbedBuilder()
.setColor('#0099ff')
.setTitle('Current Queue');
if (currentTrack) {
2024-08-17 14:58:17 -04:00
embed.addFields({ name: 'Currently playing', value: `${currentTrack.title}`, inline: false });
2024-08-17 11:11:10 -04:00
}
2024-08-17 12:10:35 -04:00
if (queue.length > 0) {
embed.addFields({
name: 'Up next',
2024-08-17 14:58:17 -04:00
value: queue.map((track, index) => `${index + 1}. ${track.title}`).join('\n'),
2024-08-17 12:10:35 -04:00
inline: false
});
} else if (!currentTrack) {
embed.setDescription('The queue is empty!');
}
2024-08-17 12:10:35 -04:00
message.channel.send({ embeds: [embed] });
2024-08-17 11:11:10 -04:00
}
2024-08-17 11:23:30 -04:00
};