feat(*): Add working code to clear the queue

This commit is contained in:
2020-10-25 23:21:19 +00:00
parent 601819b18d
commit dd685f63b3
+17
View File
@@ -16,6 +16,7 @@ client.once('ready', () =>{
* q - Join the queue * q - Join the queue
* lq - Leave the queue * lq - Leave the queue
* sq - Show the queue * sq - Show the queue
* cq - Clear the queue
*/ */
function generateRandomCode() { function generateRandomCode() {
@@ -113,4 +114,20 @@ client.on('message', function (message) {
message.delete(); message.delete();
checkQueue(message); checkQueue(message);
} }
// Clear the queue
if(command === 'cq') {
// Delete the message with the bot command
message.delete();
if (playerQueue.length === 0) {
message.channel.send(`The queue is already empty...`);
console.log(`${message.author.username} attmepted to clear the queue but it was already empty.`);
}
else{
rankedList = [];
message.channel.send(`The queue has been cleared!`);
console.log(`${message.author.username} cleared the queue.`);
}
}
}); });