This commit is contained in:
NikolajDanger
2020-08-13 21:18:07 +02:00
parent 7e8d97547c
commit 0f633af4b9

View File

@ -15,8 +15,10 @@ class Hangman():
if game == None: if game == None:
apiKey = self.bot.credentials.wordnikKey apiKey = self.bot.credentials.wordnikKey
with urllib.request.urlopen(apiUrl+apiKey) as p: word = "-"
word = list(json.load(p)[0]["word"].upper()) 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)+"\"") logThis("Found the word \""+"".join(word)+"\"")
guessed = [False] * len(word) guessed = [False] * len(word)
gameID = datetime.datetime.now().strftime('%Y%m%d%H%M%S') gameID = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
@ -43,7 +45,7 @@ class Hangman():
if game != None: if game != None:
if user == game["player"]: 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"]: if guess not in game["guessed letters"]:
correctGuess = 0 correctGuess = 0