21 lines
711 B
JavaScript
21 lines
711 B
JavaScript
const { SlashCommandBuilder } = require("discord.js");
|
|
const { resetAll, setStopped } = require("../../playback");
|
|
|
|
module.exports = {
|
|
data: new SlashCommandBuilder()
|
|
.setName("stop")
|
|
.setDescription("Stop playback and leave the voice channel"),
|
|
|
|
async execute(interaction) {
|
|
const voiceChannel = interaction.member.voice.channel;
|
|
if (!voiceChannel) {
|
|
return interaction.reply({ content: "You need to be in a voice channel to use this command.", ephemeral: true });
|
|
}
|
|
|
|
setStopped(true); // Mark playback as stopped
|
|
resetAll(voiceChannel.guild.id); // Reset everything for a clean state
|
|
|
|
return interaction.reply("Stopped playback and left the voice channel.");
|
|
},
|
|
};
|