all repos — simple-discord-music-bot @ f1b6c2135d3740fb92fc2a8f095e159d93480a4a

A Discord bot making use of discord.js and play-yt.

src/commands/clear.ts (view raw)

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