-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpause.js
30 lines (28 loc) · 1009 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
25
26
27
28
29
30
const { MessageEmbed } = require("discord.js");
const sendError = require("../util/error");
module.exports = {
info: {
name: "pause",
description: "To pause the current music in the server",
usage: "[pause]",
aliases: ["pause"],
},
run: async function (client, message, args) {
const serverQueue = message.client.queue.get(message.guild.id);
if (serverQueue && serverQueue.playing) {
serverQueue.playing = false;
try{
serverQueue.connection.dispatcher.pause()
} catch (error) {
message.client.queue.delete(message.guild.id);
return sendError(`:notes: The player has stopped and the queue has been cleared.: ${error}`, message.channel);
}
let xd = new MessageEmbed()
.setDescription("⏸ Paused the music for you!")
.setColor("YELLOW")
.setTitle("Music has been paused!")
return message.channel.send(xd);
}
return sendError("There is nothing playing in this server.", message.channel);
},
};