Add setQueue() function

This commit is contained in:
Androz2091 2020-01-18 13:04:05 +01:00
parent c160cb7e20
commit 3c33d42aa8

View file

@ -221,6 +221,24 @@ class Player {
});
}
/**
* Sets the queue for a guild.
* @param {string} guildID
* @param {Array<Song>} songs The songs list
* @returns {Promise<Queue>}
*/
setQueue(guildID, songs){
return new Promise(async(resolve, reject) => {
// Gets guild queue
let queue = this.queues.find((g) => g.guildID === guildID);
if(!queue) reject('Not playing');
// Updates queue
queue.songs = songs;
// Resolves the queue
resolve(queue);
});
}
/**
* Clears the guild queue, but not the current song.
* @param {string} guildID