From 5513268a97df6d8cb309db98177d55d2397d5924 Mon Sep 17 00:00:00 2001 From: Mathieu B Date: Wed, 28 Jul 2021 23:13:08 +0200 Subject: [PATCH] Added speak method in skill (not usable for now) + fix properties crash --- jarvis/skills/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/jarvis/skills/__init__.py b/jarvis/skills/__init__.py index 5fec1ef..03d33b8 100644 --- a/jarvis/skills/__init__.py +++ b/jarvis/skills/__init__.py @@ -42,6 +42,9 @@ class Skill: for line in infile.readlines(): intent_manager.register_regex(line.replace('\n', ''), self.name) + def speak(self, message): + print(message) + class SkillRegistering(type): def __init__(cls, name, bases, attrs): @@ -49,7 +52,7 @@ class SkillRegistering(type): if type(val) is types.FunctionType and not str(val).__contains__("__"): properties = getattr(val, "_register", None) - intent = properties[0] - intent_name = intent.name if properties is not None: + intent = properties[0] + intent_name = intent.name intent_manager.intents_handlers[f"{intent_name}"] = [getattr(cls, key), name]