From c738331f1996cc0e3d1ba48c195b4c93858c2445 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 15 Nov 2023 17:26:48 -0800 Subject: [PATCH] Prevent creating duplicate event listeners when multiple languages are supported --- ovos_workshop/skills/ovos.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ovos_workshop/skills/ovos.py b/ovos_workshop/skills/ovos.py index 51a77f42..5b1c00a8 100644 --- a/ovos_workshop/skills/ovos.py +++ b/ovos_workshop/skills/ovos.py @@ -1256,8 +1256,8 @@ def register_intent_file(self, intent_file: str, handler: callable): '.intent' handler: function to register with intent """ + name = f'{self.skill_id}:{intent_file}' for lang in self.native_langs: - name = f'{self.skill_id}:{intent_file}' resources = self.load_lang(self.res_dir, lang) resource_file = ResourceFile(resources.types.intent, intent_file) if resource_file.file_path is None: @@ -1265,8 +1265,8 @@ def register_intent_file(self, intent_file: str, handler: callable): continue filename = str(resource_file.file_path) self.intent_service.register_padatious_intent(name, filename, lang) - if handler: - self.add_event(name, handler, 'mycroft.skill.handler') + if handler: + self.add_event(name, handler, 'mycroft.skill.handler') def register_entity_file(self, entity_file: str): """