Files
BluBot/commands/music/queue.js
2025-06-21 15:13:58 -05:00

36 lines
1.1 KiB
JavaScript

const { Client, Interaction, SlashCommandBuilder, EmbedBuilder } = require('discord.js')
const { queue } = require('./../../playback')
const { musicQueueEmbed } = require('../../embeds/queue');
async function checkQueue(interaction) {
if (!queue || queue.length === 0 ) {
interaction.reply('The queue is empty.')
return
}
try {
const embed = musicQueueEmbed(queue);
await interaction.reply({ embeds: [embed] })
} catch (error) {
console.log('There is an error in the queue command: ', error)
}
}
module.exports = {
data: new SlashCommandBuilder()
.setName('queue')
.setDescription('Check the playback queue'),
async execute(interaction) {
const voiceChannel = interaction.member.voice.channel
const textChannel = interaction.textChannel
if (!voiceChannel) {
return interaction.reply({
content: 'You need to be in a voice channel to use that queue',
ephemeral: true
})
}
await checkQueue(interaction, voiceChannel, textChannel)
}
}