forked from Androz2091/discord-music-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
skip.js
27 lines (21 loc) · 871 Bytes
/
skip.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const { SlashCommand } = require('slash-create');
module.exports = class extends SlashCommand {
constructor(creator) {
super(creator, {
name: "skip",
description: "Skip to the current song",
guildIDs: process.env.DISCORD_GUILD_ID ? [ process.env.DISCORD_GUILD_ID ] : undefined
});
}
async run(ctx) {
const { client } = require('..');
await ctx.defer();
const queue = client.player.getQueue(ctx.guildID);
if (!queue || !queue.playing) return void ctx.sendFollowUp({ content: "❌ | No music is being played!" });
const currentTrack = queue.current;
const success = queue.skip();
return void ctx.sendFollowUp({
content: success ? `✅ | Skipped **${currentTrack}**!` : "❌ | Something went wrong!"
});
}
}