-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathevent.js
72 lines (62 loc) · 3.14 KB
/
event.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
const Discord = require("discord.js");
module.exports=(client)=>{
client.player
// Send a message when a track starts
.on('trackStart', (message, track) => {
const msg= new Discord.MessageEmbed()
.setColor('#FFA500')
.setTitle(`Now playing ${track.title}...`)
.setURL(`${track.url}`)
.setAuthor(`${track?.author}`)
.setThumbnail(`${track.thumbnail}`)
.setFooter(`views :- ${track.views} , Requested By : ${track.requestedBy.username}`,'https://cdn.discordapp.com/avatars/816994233557844039/c261a88ff85eee96010919fc8fe1b1e7.png')
return message.channel.send(msg).then((data)=>{
return data.react(`👍`);
});
})
// Send a message when something is added to the queue
.on('trackAdd', (message, queue, track) => {
const msg= new Discord.MessageEmbed()
.setColor('#FFA500')
.setTitle(`${track.title} added to queue`)
.setURL(`${track.url}`)
return message.channel.send(msg).then((data)=>{
return data.react(`👍`);
});
})
.on('playlistAdd', (message, queue, playlist) => message.channel.send(`${playlist.title} has been added to the queue (${playlist.tracks.length} songs)!`))
// Send messages to format search results
.on('searchResults', (message, query, tracks) => {
const embed = new Discord.MessageEmbed()
.setAuthor(`Here are your search results for ${query}!`)
.setDescription(tracks.map((t, i) => `${i}. ${t.title}`))
.setFooter('Send the number of the song you want to play!')
message.channel.send(embed);
})
.on('searchInvalidResponse', (message, query, tracks, content, collector) => {
if (content === 'cancel') {
collector.stop()
return message.channel.send('Search cancelled!')
}
message.channel.send(`You must send a valid number between 1 and ${tracks.length}!`)
})
.on('searchCancel', (message, query, tracks) => message.channel.send('You did not provide a valid response... Please send the command again!'))
.on('noResults', (message, query) => message.channel.send(`No results found on YouTube for ${query}!`))
// Send a message when the music is stopped
.on('queueEnd', (message, queue) => {
const msg= new Discord.MessageEmbed()
.setColor('#FFA500')
.setTitle(`Need Money if u want me to join Voice channel for 24x7 🙃`)
return message.channel.send(msg).then((data)=>{
return data.react(`👍`);
});
})
.on('channelEmpty', (message, queue) => {
const msg= new Discord.MessageEmbed()
.setColor('#FFA500')
.setTitle(`I am leaving Voice Channel , I dont want to be alone! 🥺`)
return message.channel.send(msg).then((data)=>{
return data.react(`👍`);
});
})
}