tildebot | Accept alternative correct anagrams

Since this means there's multiple possible answers, I made it so that the
answer can now be a function, and that gets run with the guess. This may
open the door to other puzzle ideas that have been ignored due to having
more than one correct answer.
This commit is contained in:
rakiru committed 2018-07-16 22:01:36 +01:00
1 parent f883cda857
commit 888b3e871a
2 files changed
+13 -2

No files matched your search

+1 -1
View File
@@ -146,7 +146,7 @@ def challenge_response(channel, user, name, time, msg):
print(msg);
if(challenges.has_key(user)):
answer, bonus = challenges[user]
if(msg.lower() == str(answer).lower() or msg == p.number_to_words(answer)):
if((callable(answer) and answer(msg.lower())) or (msg.lower() == str(answer).lower() or msg == p.number_to_words(answer))):
give_tilde(channel, user, name, time, True, bonus);
else:
give_tilde(channel, user, name, time, False, 0);