Fixed bots. did things

This commit is contained in:
RussellChamp committed 2019-06-14 08:47:20 -04:00
1 parent a8b397a44f
commit 4ba577b243
5 files changed
+55 -32

No files matched your search

+1 -1
View File
@@ -295,7 +295,7 @@ def valid_answer(answer, guess):
# "answers" acidentally have punctuation or other things in them
guess = re.sub(r'\W+', '', guess)
answer = re.sub(r'\w+', '', str(answer).lower())
return (msg == answer or msg == p.number_to_words(answer))
return (guess == answer or guess == p.number_to_words(answer))
def challenge_response(user, time, msg):
global challenges
+1 -1
View File
@@ -4,7 +4,7 @@ from bs4 import BeautifulSoup
import util.duckduckgo
def xkcd(query):
res = util.duckduckgo.get_zci("site:xkcd.com " + query)
res = util.duckduckgo.get_zci("site:m.xkcd.com " + query)
title = ""
try: # ddg returns a url for these searches. i want a title as well
title = BeautifulSoup(requests.get(res).content, "html.parser").title.text