Fixed assistant event constructor with new Google plugins structure

This commit is contained in:
Fabio Manganiello 2019-07-12 01:45:27 +02:00
parent 6848a2a0c1
commit b63843a130

View file

@ -1,7 +1,7 @@
import logging import logging
import re import re
from platypush.context import get_backend from platypush.context import get_backend, get_plugin
from platypush.message.event import Event, EventMatchResult from platypush.message.event import Event, EventMatchResult
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -14,11 +14,11 @@ class AssistantEvent(Event):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
try: try:
self._assistant = get_backend('assistant.google') self._assistant = get_backend('assistant.google')
except KeyError as e: except KeyError:
try: try:
self._assistant = get_backend('assistant.google.pushtotalk') self._assistant = get_plugin('assistant.google.pushtotalk')
except KeyError as e: except Exception:
logger.warning('google.assistant backend not configured/initialized') logger.warning('google.assistant not configured/initialized')
self._assistant = None self._assistant = None