all repos — simple-discord-music-bot @ 9028915a52f199d9c710a9cf35f8903433faec88

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

src/commands/stop.ts (view raw)

 1import { SlashCommandBuilder } from 'discord.js';
 2import { getChannel, stopMusic } from '../functions/music';
 3
 4module.exports = {
 5    data: new SlashCommandBuilder()
 6        .setName('stop')
 7        .setDescription('Stop the music.'),
 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 (stopMusic())
15            return await interaction.reply({ content: 'Stopped.', ephemeral: true });
16
17        return await interaction.reply({ content: 'Error.', ephemeral: true });
18    },
19};