diff --git a/lib/commands/Hangman.js b/lib/commands/Hangman.js index ac597af..f3c6278 100644 --- a/lib/commands/Hangman.js +++ b/lib/commands/Hangman.js @@ -56,9 +56,10 @@ module.exports = new Command("Hangman", condition, function(text, send, userData if (guessedLetters.indexOf(letter) !== -1) { send("You already guessed this letter"); } else { - if (word.toLowerCase().indexOf(letter.toLowerCase()) !== -1) { + letterIndex = word.toLowerCase().indexOf(letter.toLowerCase()); + if (letterIndex !== -1) { send("The letter is in the word!"); - correctLetters.push(letter); + correctLetters.push(word[letterIndex]); } else { send("The letter is not in the word.."); }