-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanager.js
50 lines (48 loc) · 1.49 KB
/
manager.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
const { Manager } = require("erela.js");
const { MessageEmbed } = require("discord.js");
module.exports = function (client) {
return new Manager({
nodes: [
{
host: "lava.link",
port: 80,
password: "SimpleMusicBot",
retryDelay: 5000,
},
],
autoPlay: true,
send: (id, payload) => {
const guild = client.guilds.cache.get(id);
if (guild) guild.shard.send(payload);
},
})
.on("nodeConnect", (node) =>
console.log(`Node "${node.options.identifier}" connected.`)
)
.on("nodeError", (node, error) =>
console.log(
`Node "${node.options.identifier}" Encountered An Error : ${error.message}.`
)
)
.on("trackStart", (player, track) => {
const channel = client.channels.cache.get(player.textChannel);
channel.send(
new MessageEmbed()
.setTitle("Now Playing...")
.setDescription(`\`\`\`prolog\n${track.title}\`\`\``)
.setFooter(`Requested By ${track.requester.tag}`)
.setColor("#2F3136")
.setTimestamp()
);
})
.on("trackEnd", (player) => {
const channel = client.channels.cache.get(player.textChannel);
channel.send(`**The Current Track Has Ended**`);
})
.on("queueEnd", (player) => {
const channel = client.channels.cache.get(player.textChannel);
channel.send("Queue has ended.");
player.destroy();
});
};
//`Now playing: \`${track.title}\`, requested by \`${track.requester.tag}\`.`