From 0f633af4b9d742eb3f2781ed2681d787c594366b Mon Sep 17 00:00:00 2001 From: NikolajDanger Date: Thu, 13 Aug 2020 21:18:07 +0200 Subject: [PATCH] :bug: --- funcs/games/hangman.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/funcs/games/hangman.py b/funcs/games/hangman.py index eb3ca59..fcf7ce3 100644 --- a/funcs/games/hangman.py +++ b/funcs/games/hangman.py @@ -15,8 +15,10 @@ class Hangman(): if game == None: apiKey = self.bot.credentials.wordnikKey - with urllib.request.urlopen(apiUrl+apiKey) as p: - word = list(json.load(p)[0]["word"].upper()) + word = "-" + while "-" in word: + with urllib.request.urlopen(apiUrl+apiKey) as p: + word = list(json.load(p)[0]["word"].upper()) logThis("Found the word \""+"".join(word)+"\"") guessed = [False] * len(word) gameID = datetime.datetime.now().strftime('%Y%m%d%H%M%S') @@ -43,7 +45,7 @@ class Hangman(): if game != None: if user == game["player"]: - if len(guess) == 1: + if len(guess) == 1 and guess in list(string.ascii_uppercase): if guess not in game["guessed letters"]: correctGuess = 0