added new module: qna-basic

This commit is contained in:
2022-10-31 22:14:53 +02:00
parent 2f6d1113b8
commit cf2223f40a
3 changed files with 37 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
msg = self.MESSAGE["text"].lower()
responce_given = False
for file in os.listdir(self.path + "db/"):
if responce_given:
break
try:
criteria = json.loads( readfile(self.path + "db/" + file) )
for wordset in criteria["trigger_lists"]:
all_words_in = True
for word in wordset:
if not word in msg:
all_words_in = False
break
if all_words_in:
self.RESPONCE = criteria["responce_text"]
responce_given = True
break
except Exception as e:
print("[WARN] module : qna-basic: db file {} raised exception \"{}\"".format(file, e))