Replace dots in Alexa built-in intent slots w/ underscores (#5092)

* Replace dots in built-in intent slots w/ underscores

* Add a built-in intent test
This commit is contained in:
Jesse Newland 2016-12-29 10:26:23 -06:00 committed by Paulus Schoutsen
parent aaff8d8602
commit a2f17cccbb
2 changed files with 70 additions and 4 deletions

View file

@ -203,11 +203,12 @@ class AlexaResponse(object):
self.reprompt = None
self.session_attributes = {}
self.should_end_session = True
self.variables = {}
if intent is not None and 'slots' in intent:
self.variables = {key: value['value'] for key, value
in intent['slots'].items() if 'value' in value}
else:
self.variables = {}
for key, value in intent['slots'].items():
if 'value' in value:
underscored_key = key.replace('.', '_')
self.variables[underscored_key] = value['value']
def add_card(self, card_type, title, content):
"""Add a card to the response."""