Skip to content

Commit

Permalink
[New] skip and stop work now with prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
naseif committed Oct 4, 2021
1 parent 6d617bf commit f8be8e8
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 4 deletions.
43 changes: 40 additions & 3 deletions commands/Music/skip.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,56 @@ const { SlashCommandBuilder } = require("@discordjs/builders");
const { embedMessage } = require("../../modules/embedSimple");

module.exports = {
name: "skip",
args: false,
description: "Skips to the next song in the Queue",
aliases: ["s"],
usage: "s || skip",
async run(message, args, client) {
const queue = client.player.getQueue(message.guild);

if (!queue || !queue.playing)
return await message.channel.send({
embeds: [
embedMessage(
"#9dcc37",
`❌ | No music is being played! [${message.member.toString()}]`
),
],
});

try {
const currnetSong = queue.current;
await queue.skip();
return await message.channel.send({
embeds: [
embedMessage(
"#9dcc37",
`Skipped **${currnetSong.title}**, [${message.member.toString()}]`
),
],
});
} catch (err) {
client.logger(err.message, "error");
await message.channel.send({
embeds: [embedMessage("#9dcc37", "Song could not be skipped")],
});
}
},
data: new SlashCommandBuilder()
.setName("skip")
.setDescription("skips a song from the queue"),

async execute(interaction, client) {
await interaction.deferReply();
const usermention = `<@${interaction.member.id}>`;
const queue = client.player.getQueue(interaction.guild);

if (!queue || !queue.playing)
return await interaction.followUp({
embeds: [
embedMessage(
"#9dcc37",
`❌ | No music is being played! [${usermention}]`
`❌ | No music is being played! [${interaction.member.toString()}]`
),
],
});
Expand All @@ -28,7 +63,9 @@ module.exports = {
embeds: [
embedMessage(
"#9dcc37",
`Skipped **${currnetSong.title}**, [<@${interaction.user.id}>]`
`Skipped **${
currnetSong.title
}**, [${interaction.member.toString()}]`
),
],
});
Expand Down
39 changes: 38 additions & 1 deletion commands/Music/stop.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,43 @@ const { SlashCommandBuilder } = require("@discordjs/builders");
const { embedMessage } = require("../../modules/embedSimple");

module.exports = {
name: "stop",
args: false,
description: "Stops the player and leaves the voice channel",
usage: "stop",
async run(message, args, client) {
const queue = client.player.getQueue(message.guild);

if (!queue || !queue.playing) {
return await message.channel.send({
embeds: [
embedMessage(
"#9dcc37",
`❌ | ${message.member.toString()}, Nothing is playing to stop!`
),
],
});
}

try {
if (queue && queue.playing) {
await message.channel.send({
embeds: [
embedMessage(
"#9dcc37",
`✅ Stopped **${queue.current.title}** in [<#${message.member.voice.channel}>]`
),
],
});
await queue.stop();
}
} catch (err) {
client.logger(err.message, "error");
await message.channel.send({
embeds: [embedMessage("#9dcc37", `❌ | Something went wrong :/`)],
});
}
},
data: new SlashCommandBuilder()
.setName("stop")
.setDescription("stops the current song playing"),
Expand All @@ -15,7 +52,7 @@ module.exports = {
embeds: [
embedMessage(
"#9dcc37",
`❌ | <@${interaction.user.id}>, Nothing is playing to stop!`
`❌ | ${interaction.member.toString()}, Nothing is playing to stop!`
),
],
});
Expand Down

0 comments on commit f8be8e8

Please sign in to comment.