From a098812f0ee792093677d8aa85ee2c492bf9cac2 Mon Sep 17 00:00:00 2001 From: emphasize Date: Thu, 12 Oct 2023 23:10:11 +0200 Subject: [PATCH] deprecate old message types --- ovos_workshop/skills/ovos.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/ovos_workshop/skills/ovos.py b/ovos_workshop/skills/ovos.py index dbdb8ac4..3787d325 100644 --- a/ovos_workshop/skills/ovos.py +++ b/ovos_workshop/skills/ovos.py @@ -915,8 +915,14 @@ def _register_system_event_handlers(self): if self.stop_is_implemented: self.add_event('mycroft.stop', self.__handle_stop, speak_errors=False) + # TODO: deprectate 0.0.9 + self.add_event("skill.converse.ping", self._handle_converse_ack, + speak_errors=False) self.add_event(f"{self.skill_id}.converse.ping", self._handle_converse_ack, speak_errors=False) + # TODO: deprecate 0.0.9 + self.add_event("skill.converse.request", self._handle_converse_request, + speak_errors=False) self.add_event(f"{self.skill_id}.converse.request", self._handle_converse_request, speak_errors=False) self.add_event(f"{self.skill_id}.activate", self.handle_activate, @@ -938,6 +944,8 @@ def _register_system_event_handlers(self): self.add_event('mycroft.skills.settings.changed', self.handle_settings_change, speak_errors=False) + # TODO: deprecate 0.0.9 + self.add_event("skill.converse.get_response", self.__handle_get_response, speak_errors=False) self.add_event(f"{self.skill_id}.converse.get_response", self.__handle_get_response, speak_errors=False) def _send_public_api(self, message: Message): @@ -1019,6 +1027,11 @@ def _handle_converse_ack(self, message: Message): `active` status. @param message: `{self.skill_id}.converse.ping` Message """ + if message.msg_type == "skill.converse.ping": + log_deprecation("Support for message type `skill.converse.ping` is deprecated, use `{skill_id}.converse.ping`", "0.0.9") + if message.data.get("skill_id") != self.skill_id: + return # not for us! + self.bus.emit(message.reply( "skill.converse.pong", data={"skill_id": self.skill_id, @@ -1031,6 +1044,11 @@ def _handle_converse_request(self, message: Message): with `converse`. @param message: `{self.skill_id}.converse.request` Message """ + if message.msg_type == "skill.converse.request": + log_deprecation("Support for message type `skill.converse.request` is deprecated, use `{skill_id}.converse.request`", "0.0.9") + if message.data.get("skill_id") != self.skill_id: + return # not for us! + try: # converse can have multiple signatures params = signature(self.converse).parameters @@ -1543,6 +1561,15 @@ def converse(utterances, lang=None): return ans def __handle_get_response(self, message): + """ + Handle the response message to a previous get_response / speak call + sent from the intent service + """ + if message.msg_type == "skill.converse.get_response": + log_deprecation("Support for message type `skill.converse.get_response` is deprecated, use `{skill_id}.converse.get_response`", "0.0.9") + if message.data.get("skill_id") != self.skill_id: + return # not for us! + # validate session_id to ensure this isnt another # user querying the skill at same time sess2 = SessionManager.get(message)