def find_response(self): db = DB() db.init() if self.intent == "admissibilite_congé": if self.find: get = db.find_one(self.collection, {"intent": self.intent}) return random.choice(get['response']) else: return {"message": "Object not found."} else: if self.find: get = db.find_one(self.collection, {"intent": self.intent}) return get['response'] else: return {"message": "Object not found."}
def find(self): db = DB() db.init() if db.find_one(self.collection, {"intent": self.intent}): return True else: return False
def find_response(self): db = DB() db.init() if self.find: get = db.find_one(self.collection, {"intent": self.intent, "entity": self.entity}) return get['response'] else: return {"message": "Object not found."}