forked from Androz2091/discord-music-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pause.js
24 lines (18 loc) · 777 Bytes
/
pause.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
const { SlashCommand } = require('slash-create');
module.exports = class extends SlashCommand {
constructor(creator) {
super(creator, {
name: "pause",
description: "Pause 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 paused = queue.setPaused(true);
return void ctx.sendFollowUp({ content: paused ? "⏸ | Paused!" : "❌ | Something went wrong!" });
}
}