first commit
This commit is contained in:
36
commands/music/queue.js
Normal file
36
commands/music/queue.js
Normal file
@ -0,0 +1,36 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user