Skip to content

Commit

Permalink
[New] Readded stop command based on a request
Browse files Browse the repository at this point in the history
  • Loading branch information
naseif committed Aug 30, 2021
1 parent e1c9be9 commit 90d82ac
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions commands/music/stop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const { embedMessage } = require("../../modules/embedSimple");

module.exports = {
data: new SlashCommandBuilder()
.setName("stop")
.setDescription("stops the current song playing"),

async execute(interaction, client) {
const queue = client.player.getQueue(interaction.guild);
await interaction.deferReply();

if (!queue || !queue.playing) {
return await interaction.followUp({
embeds: [
embedMessage(
"#9dcc37",
`❌ | <@${interaction.user.id}>, Nothing is playing to stop!`
),
],
});
}

try {
if (queue && queue.playing) {
await interaction.followUp({
embeds: [
embedMessage(
"#9dcc37",
`✅ Stopped **${queue.current.title}** in [<#${interaction.member.voice.channelId}>]`
),
],
});
await queue.stop();
}
} catch (err) {
await interaction.followUp({
embeds: [embedMessage("#9dcc37", `❌ | Something went wrong :/`)],
});
}
},
};

0 comments on commit 90d82ac

Please sign in to comment.