commands/clear.js (view raw)
1const { SlashCommandBuilder } = require('discord.js');
2const { getChannel, clearQueue } = require('../functions/music');
3
4module.exports = {
5 data: new SlashCommandBuilder()
6 .setName('clear')
7 .setDescription('Clear the queue.'),
8
9 async execute(interaction) {
10 const channel = await getChannel(interaction);
11 if (typeof channel == 'string')
12 return await interaction.reply({ content: channel, ephemeral: true });
13
14 if (clearQueue())
15 return await interaction.reply({ content: 'Queue cleared.' });
16
17 return await interaction.reply({ content: 'Error.' });
18 },
19};