Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. # --------------- Main handler ------------------
  2. def lambda_handler(event, context):
  3. if event['request']['intent']['name'] == 'HelloIntent':
  4. return HelloIntent(event)
  5.  
  6. If event['request']['intent']['name'] == 'HelloAsk':
  7. return HelloAsk(event)
  8.  
  9. If event['request']['intent']['name'] == 'Response':
  10. if event ['request']['intent']['name'] == 'positive':
  11.  
  12. if event['request']['intent']['slots']['name'] == 'negitive':
  13. # TODO: write code... event ['request']['intent']['name'] == 'positive':
  14. # --------------- Functions that control the skill's behavior ------------------
  15. def HelloIntent(event):
  16. return response("Hi there!", False)
  17.  
  18. def HelloAsk(event):
  19. return response("I am doing well today.",False)
  20.  
  21. # --------------- Helper that build all of the responses ----------------------
  22.  
  23. def response(text, should_end_session):
  24. return {
  25. "version": "1.0",
  26. "response": {
  27. "outputSpeech": {
  28. "text": text,
  29. "type": "PlainText"
  30. },
  31. "speechletResponse": {
  32. "outputSpeech": {
  33. "text": text
  34. },
  35. "shouldEndSession": should_end_session
  36. }
  37. },
  38. "sessionAttributes": {}
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement