From 54b1f60e11b224dd0430fefa632b096ac2f23778 Mon Sep 17 00:00:00 2001 From: Josh Creek Date: Mon, 26 Oct 2020 16:36:14 +0000 Subject: [PATCH] fix(*): Fix bug with blank pokemon name and captain ign fields showing --- index.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index da70f30..7867d90 100644 --- a/index.js +++ b/index.js @@ -69,7 +69,12 @@ function checkQueue(message) { // DM users const randomCode = generateRandomCode(); playerQueue.forEach(player => { - client.users.cache.get(player.id).send(`${queueTitle}\nPokemon: ${pokemonName}\Captain's IGN: ${captainInGameName}\nHere is your link code ${randomCode} - @${playerQueue[0].username} is making the lobby, have fun!`); + if (pokemonName === '' && captainInGameName === '') { + client.users.cache.get(player.id).send(`${queueTitle}\nHere is your link code ${randomCode} - @${playerQueue[0].username} is making the lobby, have fun!`); + } + else { + client.users.cache.get(player.id).send(`${queueTitle}\nPokemon: ${pokemonName}\nCaptain's IGN: ${captainInGameName}\nHere is your link code ${randomCode} - @${playerQueue[0].username} is making the lobby, have fun!`); + } }); } catch (error) { logger.log('error', error); @@ -89,12 +94,11 @@ function checkQueue(message) { } else { // Show queue after adding - - if (pokemonName.length > 0 && captainInGameName.length > 0) { - message.channel.send(`${queueTitle}\nPokemon: ${pokemonName}\Captain's IGN: ${captainInGameName}\n${playerQueue.map((player, index) => `${index + 1} - ${player.username}`).join('\n')}`); + if (pokemonName === '' && captainInGameName === '') { + message.channel.send(`${queueTitle}\n${playerQueue.map((player, index) => `${index + 1} - ${player.username}`).join('\n')}`); } else { - message.channel.send(`${queueTitle}\n${playerQueue.map((player, index) => `${index + 1} - ${player.username}`).join('\n')}`); + message.channel.send(`${queueTitle}\nPokemon: ${pokemonName}\nCaptain's IGN: ${captainInGameName}\n${playerQueue.map((player, index) => `${index + 1} - ${player.username}`).join('\n')}`); } } }