-
Notifications
You must be signed in to change notification settings - Fork 0
/
skip.js
41 lines (35 loc) · 1.38 KB
/
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const { Util, MessageEmbed } = require("discord.js");
const sendError = require("../util/error");
module.exports = {
info: {
name: "skip",
description: "Toca a proxima música",
usage: "",
aliases: ["s"],
},
run: async function (client, message, args) {
const channel = message.member.voice.channel
if (!channel)return sendError("Você precisa está em um canal de voz para executar este comando", message.channel);
const serverQueue = message.client.queue.get(message.guild.id);
if (!serverQueue)return sendError("Não há uma música tocando agora", message.channel);
if(!serverQueue.connection)return
if(!serverQueue.connection.dispatcher)return
if (serverQueue && !serverQueue.playing) {
serverQueue.playing = true;
serverQueue.connection.dispatcher.resume();
let xd = new MessageEmbed()
.setDescription("▶ A música foi resumida")
.setColor("PURPLE")
.setTitle("Resumindo a música")
return message.channel.send(xd).catch(err => console.log(err));
}
try{
serverQueue.connection.dispatcher.end()
} catch (error) {
serverQueue.voiceChannel.leave()
message.client.queue.delete(message.guild.id);
return sendError(`:notes: The player has stopped and the queue has been cleared.: ${error}`, message.channel);
}
message.react("✅")
},
};