blob: e0fbee141921c4cee0d113d41869b96235996803 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
const { EmbedBuilder } = require('discord.js');
const { formatDuration } = require('../utils/player');
const { getQueueOrReply } = require('../utils/helpers');
function handleQueue(interaction, queues) {
const queue = getQueueOrReply(interaction, queues, 'Queue is empty!');
if (!queue || queue.songs.length === 0) {
if (queue) interaction.reply('Queue is empty!');
return;
}
const nowPlaying = queue.songs[0];
const upcoming = queue.songs.slice(1, 10);
const embed = new EmbedBuilder()
.setColor(0x0099ff)
.setTitle('Queue')
.setDescription(
`**Now Playing:**\n${nowPlaying.title}\n` +
`Duration: ${formatDuration(nowPlaying.duration)} | Requested by: ${nowPlaying.requestedBy}`
)
.setThumbnail(nowPlaying.thumbnail);
if (upcoming.length > 0) {
const upcomingText = upcoming
.map((song, i) => `${i + 1}. ${song.title} - ${formatDuration(song.duration)}`)
.join('\n');
embed.addFields({ name: 'Up Next', value: upcomingText });
}
if (queue.songs.length > 10) {
embed.setFooter({ text: `...and ${queue.songs.length - 10} more` });
}
interaction.reply({ embeds: [embed] });
}
module.exports = { handleQueue };
|