mirror of
https://github.com/jcreek/denBot.git
synced 2026-07-13 02:43:46 +00:00
fix(*): Hand edge cases for the start command
This commit is contained in:
@@ -136,9 +136,11 @@ function checkQueue(message) {
|
|||||||
|
|
||||||
makeTempChannel(message, adventureMessage);
|
makeTempChannel(message, adventureMessage);
|
||||||
|
|
||||||
// Clear the queue
|
// Clear the queue and votes
|
||||||
playerQueue = [];
|
playerQueue = [];
|
||||||
logger.log('info', 'Emptied queue');
|
logger.log('info', 'Emptied queue');
|
||||||
|
playerVotes = [];
|
||||||
|
logger.log('info', 'Emptied votes');
|
||||||
}
|
}
|
||||||
else if (playerQueue.length === 0) {
|
else if (playerQueue.length === 0) {
|
||||||
message.channel.send('The queue is empty :(');
|
message.channel.send('The queue is empty :(');
|
||||||
@@ -328,6 +330,9 @@ client.on('message', function (message) {
|
|||||||
if(playerQueue.length == 0) {
|
if(playerQueue.length == 0) {
|
||||||
message.channel.send(`You can only vote to start an adventure early if there is a queue. You can start a queue by using the command ${config.prefix}help`);
|
message.channel.send(`You can only vote to start an adventure early if there is a queue. You can start a queue by using the command ${config.prefix}help`);
|
||||||
}
|
}
|
||||||
|
else if (!playerQueue.includes(message.author)) {
|
||||||
|
message.channel.send(`You can only vote to start an adventure early if you are in the queue. You can join the queue by using the command ${config.prefix}q`);
|
||||||
|
}
|
||||||
else if(playerVotes.length == 0) {
|
else if(playerVotes.length == 0) {
|
||||||
// First player to vote
|
// First player to vote
|
||||||
playerVotes.push(message.author);
|
playerVotes.push(message.author);
|
||||||
@@ -379,8 +384,9 @@ client.on('message', function (message) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
playerQueue = [];
|
playerQueue = [];
|
||||||
|
playerVotes = [];
|
||||||
message.channel.send(`The queue has been cleared!`);
|
message.channel.send(`The queue has been cleared!`);
|
||||||
logger.log('info', `${message.author.username} cleared the queue.`);
|
logger.log('info', `${message.author.username} cleared the queue and the votes.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user