Fix late binding issue in car-manual-skill

This commit is contained in:
Ceda EI 2021-01-03 18:39:04 +05:30
parent 2c682eac44
commit b78f211ccb
1 changed files with 3 additions and 4 deletions

View File

@ -35,11 +35,10 @@ class CarManual(MycroftSkill):
dialog_file.write("\n") dialog_file.write("\n")
def initialize(self): def initialize(self):
def handler(intent):
return lambda message: self.generic_handler(intent, message)
for key in self.questions: for key in self.questions:
self.register_intent( self.register_intent(f"{key}.intent", handler(key))
f"{key}.intent",
lambda y: self.generic_handler(key, y)
)
def generic_handler(self, intent_id, message): def generic_handler(self, intent_id, message):
title = self.questions[intent_id]["title"] title = self.questions[intent_id]["title"]