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