This commit is contained in:
Aevann1 2022-02-22 15:34:41 +02:00
parent 2265982fba
commit 97295d2dfd
8 changed files with 13 additions and 27 deletions

View file

@ -17,14 +17,9 @@ import requests
from shutil import copyfile
from json import loads
from collections import Counter
from enchant import Dict
import nltk
nltk.download('words')
from nltk.corpus import words
words = set(WORDLE_LIST) | set(words.words())
words = set([x for x in words if len(x) == 5])
d = Dict("en_US")
IMGUR_KEY = environ.get("IMGUR_KEY").strip()
@ -1106,7 +1101,7 @@ def handle_wordle_action(cid, v):
try: guess = request.values.get("guess").strip().lower()
except: abort(400)
if len(guess) != 5 or guess not in words:
if len(guess) != 5 or not d.check(guess) and guess not in WORDLE_LIST:
return {"error": "Not a valid guess!"}, 400
if status == "active":