-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathskipto.js
118 lines (112 loc) · 3.75 KB
/
skipto.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
const { MessageEmbed } = require("discord.js");
const { TrackUtils, Player } = require("erela.js");
module.exports = {
name: "skipto",
description: `Skip to a song in the queue`,
usage: "<number>",
permissions: {
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
member: [],
},
aliases: ["st"],
/**
*
* @param {import("../structures/DiscordMusicBot")} client
* @param {import("discord.js").Message} message
* @param {string[]} args
* @param {*} param3
*/
run: async (client, message, args, { GuildDB }) => {
const player = client.Manager.create({
guild: message.guild.id,
voiceChannel: message.member.voice.channel.id,
textChannel: message.channel.id,
selfDeafen: false,
});
if (!player) return client.sendTime(message.channel, "❌ | **Nothing is playing right now...**");
if (!message.member.voice.channel) return client.sendTime(message.channel, "❌ | **You must be in a voice channel to use this command!**");
//else if(message.guild.me.voice && message.guild.me.voice.channel.id !== message.member.voice.channel.id)return client.sendTime(message.channel, `❌ | **You must be in ${guild.me.voice.channel} to use this command.**`);
try {
if (!args[0])
return message.channel.send(new MessageEmbed()
.setColor("GREEN")
.setDescription(`**Usage**: \`${GuildDB.prefix}skipto [number]\``)
);
//if the wished track is bigger then the Queue Size
if (Number(args[0]) > player.queue.size)
return message.channel.send(new MessageEmbed()
.setColor("GREEN")
.setDescription(`❌ | That song is not in the queue! Please try again!`)
);
//remove all tracks to the jumped song
player.queue.remove(0, Number(args[0]) - 1);
//stop the player
player.stop()
//Send Success Message
return message.channel.send(new MessageEmbed()
.setDescription(`⏭ Skipped \`${Number(args[0] - 1)}\` songs`)
.setColor("GREEN")
);
} catch (e) {
console.log(String(e.stack).bgRed)
client.sendError(
message.channel,
"Something went wrong."
);
}
},
SlashCommand: {
options: [
{
name: "track",
value: "[track]",
type: 4,
required: true,
description: "Remove a song from the queue",
},
],
/**
*
* @param {import("../structures/DiscordMusicBot")} client
* @param {import("discord.js").Message} message
* @param {string[]} args
* @param {*} param3
*/
run: async (client, interaction, args, { GuildDB }) => {
const player = client.Manager.create({
guild: interaction.guild_id,
voiceChannel: interaction.member.voice.channel.id,
textChannel: interaction.channel.id,
selfDeafen: false,
});
try {
if (!args[0])
return interaction.send(new MessageEmbed()
.setColor("GREEN")
.setDescription(`**Usage**: \`${GuildDB.prefix}skipto <number>\``)
);
//if the wished track is bigger then the Queue Size
if (Number(args[0]) > player.queue.size)
return interaction.send(new MessageEmbed()
.setColor("GREEN")
.setTitle(`❌ | That song is not in the queue! Please try again!`)
);
//remove all tracks to the jumped song
player.queue.remove(0, Number(args[0]) - 1);
//stop the player
player.stop()
//Send Success Message
return interaction.send(new MessageEmbed()
.setDescription(`⏭ Skipped \`${Number(args[0])}\` songs`)
.setColor("GREEN")
);
} catch (e) {
console.log(String(e.stack).bgRed)
client.sendError(
interaction,
"Something went wrong."
);
}
},
}
};