]> jfr.im git - erebus.git/blobdiff - modules/trivia.py
added regex question search
[erebus.git] / modules / trivia.py
index 3f541a55bc64b997c1dd287ed22270ae437d0830..837181d9d9aeab9dcb0a8c84bcc236eb455faed4 100644 (file)
@@ -551,7 +551,8 @@ def questionpause(bot, user, chan, realtarget, *args):
 
 @lib.hook(glevel=1, needchan=False)
 def findq(bot, user, chan, realtarget, *args):
-       matches = [str(i) for i in range(len(state.db['questions'])) if state.db['questions'][i][0] == ' '.join(args)] #TODO looser equality check
+       searcher = re.compile(' '.join(args))
+       matches = [str(i) for i in range(len(state.db['questions'])) if searcher.search(state.db['questions'][i][0]) is not None]
        if len(matches) > 1:
                bot.msg(user, "Multiple matches: %s" % (', '.join(matches)))
        elif len(matches) == 1: