From 75c6abf249231231fcca4485f16cdd0c087fd906 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 25 Nov 2019 23:16:33 +0100 Subject: [PATCH] Pass the assistant object on the Alexa events --- platypush/plugins/assistant/echo/__init__.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/platypush/plugins/assistant/echo/__init__.py b/platypush/plugins/assistant/echo/__init__.py index 43e357044..2ba5c8b41 100644 --- a/platypush/plugins/assistant/echo/__init__.py +++ b/platypush/plugins/assistant/echo/__init__.py @@ -79,23 +79,20 @@ class AssistantEchoPlugin(AssistantPlugin): self._ready = True return _callback - @staticmethod - def _on_listening(): + def _on_listening(self): def _callback(): - get_bus().post(ConversationStartEvent()) + get_bus().post(ConversationStartEvent(assistant=self)) return _callback - @staticmethod - def _on_speaking(): + def _on_speaking(self): def _callback(): # AVS doesn't provide a way to access the response text - get_bus().post(ResponseEvent(response_text='')) + get_bus().post(ResponseEvent(assistant=self, response_text='')) return _callback - @staticmethod - def _on_finished(): + def _on_finished(self): def _callback(): - get_bus().post(ConversationEndEvent()) + get_bus().post(ConversationEndEvent(assistant=self)) return _callback def _on_disconnected(self): @@ -103,11 +100,10 @@ class AssistantEchoPlugin(AssistantPlugin): self._ready = False return _callback - @staticmethod - def _on_thinking(): + def _on_thinking(self): def _callback(): # AVS doesn't provide a way to access the detected text - get_bus().post(SpeechRecognizedEvent(phrase='')) + get_bus().post(SpeechRecognizedEvent(assistant=self, phrase='')) return _callback @action