first commit
This commit is contained in:
20
commands/music/stop.js
Normal file
20
commands/music/stop.js
Normal file
@ -0,0 +1,20 @@
|
||||
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.");
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user