Fixed corner case on event match in case the named argument is the last token
This commit is contained in:
parent
44a64b8cac
commit
f2e5ba1eef
2 changed files with 9 additions and 3 deletions
|
@ -135,8 +135,9 @@ class Event(Message):
|
||||||
result.parsed_args[argname] += ' ' + event_token
|
result.parsed_args[argname] += ' ' + event_token
|
||||||
|
|
||||||
|
|
||||||
if len(event_tokens) > 1 and len(condition_tokens) > 1 \
|
if len(condition_tokens) == 1 \
|
||||||
and event_tokens[1] == condition_tokens[1]:
|
or (len(event_tokens) > 1 and len(condition_tokens) > 1 \
|
||||||
|
and event_tokens[1] == condition_tokens[1]):
|
||||||
# Stop appending tokens to this argument, as the next
|
# Stop appending tokens to this argument, as the next
|
||||||
# condition will be satisfied as well
|
# condition will be satisfied as well
|
||||||
condition_tokens.pop(0)
|
condition_tokens.pop(0)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import logging
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from platypush.context import get_backend
|
from platypush.context import get_backend
|
||||||
|
@ -8,7 +9,11 @@ class AssistantEvent(Event):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
try:
|
||||||
self._assistant = get_backend('assistant.google')
|
self._assistant = get_backend('assistant.google')
|
||||||
|
except KeyError as e:
|
||||||
|
logging.warning('google.assistant backend not configured/initialized')
|
||||||
|
self._assistant = None
|
||||||
|
|
||||||
|
|
||||||
class ConversationStartEvent(AssistantEvent):
|
class ConversationStartEvent(AssistantEvent):
|
||||||
|
|
Loading…
Reference in a new issue