feat: getQueue is now synchronous

This commit is contained in:
Androz2091 2020-01-18 18:29:53 +01:00
parent 227128049b
commit e213485293
2 changed files with 6 additions and 10 deletions

View file

@ -929,7 +929,7 @@
<h4 class="name" id="getQueue"><span class="type-signature"></span>getQueue<span class="signature">(guildID)</span><span class="type-signature"> &rarr; {Promise.&lt;<a href="Queue.html">Queue</a>>}</span></h4>
<h4 class="name" id="getQueue"><span class="type-signature"></span>getQueue<span class="signature">(guildID)</span><span class="type-signature"> &rarr; (nullable) {<a href="Queue.html">Queue</a>}</span></h4>
@ -1061,7 +1061,7 @@
</dt>
<dd>
<span class="param-type"><code>Promise.&lt;<a href="Queue.html">Queue</a>></code></span>
<span class="param-type"><code><a href="Queue.html">Queue</a></code></span>
</dd>

View file

@ -187,16 +187,12 @@ class Player {
/**
* Gets the guild queue.
* @param {string} guildID
* @returns {Promise<Queue>}
* @returns {?Queue}
*/
getQueue(guildID) {
return new Promise(async(resolve, reject) => {
// Gets guild queue
let queue = this.queues.find((g) => g.guildID === guildID);
if(!queue) reject('Not playing');
// Resolves the guild queue
resolve(queue);
});
return queue;
}
/**