From 3c33d42aa8af98dc0d60da0150dc340c15600961 Mon Sep 17 00:00:00 2001 From: Androz2091 Date: Sat, 18 Jan 2020 13:04:05 +0100 Subject: [PATCH] Add setQueue() function --- src/Player.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Player.js b/src/Player.js index fe9b32e..76dec81 100644 --- a/src/Player.js +++ b/src/Player.js @@ -221,6 +221,24 @@ class Player { }); } + /** + * Sets the queue for a guild. + * @param {string} guildID + * @param {Array} songs The songs list + * @returns {Promise} + */ + 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