Added speak method in skill (not usable for now) + fix properties crash

This commit is contained in:
Mathieu B 2021-07-28 23:13:08 +02:00
parent cb4e5ee7d8
commit 5513268a97

View File

@ -42,6 +42,9 @@ class Skill:
for line in infile.readlines(): for line in infile.readlines():
intent_manager.register_regex(line.replace('\n', ''), self.name) intent_manager.register_regex(line.replace('\n', ''), self.name)
def speak(self, message):
print(message)
class SkillRegistering(type): class SkillRegistering(type):
def __init__(cls, name, bases, attrs): def __init__(cls, name, bases, attrs):
@ -49,7 +52,7 @@ class SkillRegistering(type):
if type(val) is types.FunctionType and not str(val).__contains__("__"): if type(val) is types.FunctionType and not str(val).__contains__("__"):
properties = getattr(val, "_register", None) properties = getattr(val, "_register", None)
intent = properties[0]
intent_name = intent.name
if properties is not None: if properties is not None:
intent = properties[0]
intent_name = intent.name
intent_manager.intents_handlers[f"{intent_name}"] = [getattr(cls, key), name] intent_manager.intents_handlers[f"{intent_name}"] = [getattr(cls, key), name]