2 Commits

+22 -16
View File
@@ -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.`);
} }
} }
@@ -440,12 +446,12 @@ client.on('message', function (message) {
if (command === 'help') { if (command === 'help') {
let msg = ` let msg = `
The commands available to you are: The commands available to you are:
- ${command}q - Join the queue - ${config.prefix}q - Join the queue
- ${command}q <pokemon> <ign> - Join the queue (first player can set the pokemon and their in-game name) - ${config.prefix}q <pokemon> <ign> - Join the queue (first player can set the pokemon and their in-game name)
- ${command}lq - Leave the queue - ${config.prefix}lq - Leave the queue
- ${command}sq - Show the queue - ${config.prefix}sq - Show the queue
- ${command}start - Vote to start the adventure early, without the full number of players (all players in the queue must use this to start early) - ${config.prefix}start - Vote to start the adventure early, without the full number of players (all players in the queue must use this to start early)
- ${command}dc - Delete an adventure channel (only the captain can use this) - ${config.prefix}dc - Delete an adventure channel (only the captain can use this)
`; `;
message.channel.send(msg); message.channel.send(msg);
@@ -454,14 +460,14 @@ The commands available to you are:
if (command === 'adminhelp') { if (command === 'adminhelp') {
let msg = ` let msg = `
The commands available to you are: The commands available to you are:
- ${command}q - Join the queue - ${config.prefix}q - Join the queue
- ${command}q <pokemon> <ign> - Join the queue (first player can set the pokemon and their in-game name) - ${config.prefix}q <pokemon> <ign> - Join the queue (first player can set the pokemon and their in-game name)
- ${command}lq - Leave the queue - ${config.prefix}lq - Leave the queue
- ${command}sq - Show the queue - ${config.prefix}sq - Show the queue
- ${command}start - Vote to start the adventure early, without the full number of players (all players in the queue must use this to start early) - ${config.prefix}start - Vote to start the adventure early, without the full number of players (all players in the queue must use this to start early)
- ${command}cq - Clear the queue (admin-only, not to be shared with normal users) - ${config.prefix}cq - Clear the queue (admin-only, not to be shared with normal users)
- ${command}ru - Remove a tagged user from the queue (admin-only, not to be shared with normal users) - ${config.prefix}ru - Remove a tagged user from the queue (admin-only, not to be shared with normal users)
- ${command}dc - Delete an adventure channel (only the captain can use this) - ${config.prefix}dc - Delete an adventure channel (only the captain can use this)
`; `;
message.channel.send(msg); message.channel.send(msg);