-
Notifications
You must be signed in to change notification settings - Fork 0
/
SongPlayer.js
44 lines (34 loc) · 1.71 KB
/
SongPlayer.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
const ytdl = require('ytdl-core');
class SongPlayer {
constructor() {
}
start(hwChan, client) {
if (!hwChan) return 'Channel Does Not Exist'
hwChan.join().then(connection => {
// Yay, it worked!
connection.play(ytdl('https://www.youtube.com/watch?v=5qap5aO4i9A',)).on('end', () => { return 'ddd' })
// client.on('voiceStateUpdate', (oldMember, newMember) => {
// const newUserChannel = newMember.voice.channelID
// const oldUserChannel = oldMember.voice.channelID
// if(newUserChannel === '712677767333937284') {
// if (client.channels.cache.find(channel => channel.name === "homework-stream").members.size == 1) {
// connection.play(ytdl('https://www.youtube.com/watch?v=5qap5aO4i9A',)).on('end', () => { return 'ddd' })
// }
// } else if (oldUserChannel === '712677767333937284' && newUserChannel !== '712677767333937284') {
// if (client.channels.cache.find(channel => channel.name === "homework-stream").members.size == 0) {
// client.leaveVoiceChannel(client.channels.cache.find(channel => channel.name === "homework-stream").channelID)
// }
// }
// })
}).catch(e => {
// Oh no, it errored! Let's log it to console :)
console.error(e);
client.channels.cache.find(channel => channel.name === "bots").send('**ERROR**\n' + e)
});
}
leave(client, channelID) {
client.leaveVoiceChannel(channelID);
}
}
module.exports = SongPlayer;
//serverQueue.songs.push(serverQueue.songs.shift());