✨ Better credentials
This commit is contained in:
@ -3,16 +3,15 @@ import json, urllib, random, datetime, string
|
||||
from . import hangmanDraw, money
|
||||
from funcs import getName, logThis
|
||||
|
||||
def hangmanStart(channel,user):
|
||||
apiUrl = "https://api.wordnik.com/v4/words.json/randomWords?hasDictionaryDef=true&minCorpusCount=10000&maxCorpusCount=-1&minDictionaryCount=1&maxDictionaryCount=-1&minLength=3&maxLength=11&limit=1&api_key="
|
||||
|
||||
def hangmanStart(channel,user,apiKey):
|
||||
with open("resources/games/hangmanGames.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
if channel not in data:
|
||||
with urllib.request.urlopen("https://random-word-api.herokuapp.com/word?number=20") as p:
|
||||
words = json.load(p)
|
||||
word = "disestablishmentarianism"
|
||||
while len(word) > 11:
|
||||
word = list(random.choice(words).upper())
|
||||
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')
|
||||
@ -97,10 +96,10 @@ def hangmanGuess(channel,user,guess):
|
||||
else:
|
||||
return "There's no Hangman game going on in this channel", False, False, []
|
||||
|
||||
def parseHangman(channel,user,command):
|
||||
def parseHangman(channel,user,command,apiKey):
|
||||
if command == "start":
|
||||
try:
|
||||
return hangmanStart(channel,user)
|
||||
return hangmanStart(channel,user,apiKey)
|
||||
except:
|
||||
logThis("Error starting game (error code 1730)")
|
||||
elif command == "stop":
|
||||
|
Reference in New Issue
Block a user