parent
f9c6bf29fe
commit
8385fbe00b
1 changed files with 4 additions and 4 deletions
|
@ -213,7 +213,7 @@ class Player extends EventEmitter {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// Get guild queue
|
// Get guild queue
|
||||||
const queue = this.queues.find((g) => g.guildID === message.guild.id)
|
const queue = this.queues.find((g) => g.guildID === message.guild.id)
|
||||||
if (!queue) return reject(new Error('Not playing'))
|
if (!queue) this.emit('error', 'NotPlaying', message)
|
||||||
Object.keys(newFilters).forEach((filterName) => {
|
Object.keys(newFilters).forEach((filterName) => {
|
||||||
queue.filters[filterName] = newFilters[filterName]
|
queue.filters[filterName] = newFilters[filterName]
|
||||||
})
|
})
|
||||||
|
@ -240,7 +240,7 @@ class Player extends EventEmitter {
|
||||||
*/
|
*/
|
||||||
_addTrackToQueue (message, track) {
|
_addTrackToQueue (message, track) {
|
||||||
const queue = this.getQueue(message)
|
const queue = this.getQueue(message)
|
||||||
if (!queue) throw new Error('NotPlaying')
|
if (!queue) this.emit('error', 'NotPlaying', message)
|
||||||
if (!track || !(track instanceof Track)) throw new Error('No track to add to the queue specified')
|
if (!track || !(track instanceof Track)) throw new Error('No track to add to the queue specified')
|
||||||
queue.tracks.push(track)
|
queue.tracks.push(track)
|
||||||
return queue
|
return queue
|
||||||
|
@ -270,7 +270,7 @@ class Player extends EventEmitter {
|
||||||
_createQueue (message, track) {
|
_createQueue (message, track) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const channel = message.member.voice ? message.member.voice.channel : null
|
const channel = message.member.voice ? message.member.voice.channel : null
|
||||||
if (!channel) reject(new Error('NotConnected'))
|
if (!channel) this.emit('error', 'NotConnected', message)
|
||||||
const queue = new Queue(message.guild.id, message, this.filters)
|
const queue = new Queue(message.guild.id, message, this.filters)
|
||||||
this.queues.set(message.guild.id, queue)
|
this.queues.set(message.guild.id, queue)
|
||||||
channel.join().then((connection) => {
|
channel.join().then((connection) => {
|
||||||
|
@ -282,7 +282,7 @@ class Player extends EventEmitter {
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
this.queues.delete(message.guild.id)
|
this.queues.delete(message.guild.id)
|
||||||
reject(new Error('UnableToJoin'))
|
this.emit('error', 'UnableToJoin', message)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue