Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. if("CreateItem".Equals(intentName))
  2. {
  3. //Get our Trello Board
  4. var board = GetBoard(intent, member);
  5. //Get the first list from the board
  6. var list = board.Lists.FirstOrDefault();
  7. //Do some whimiscal error handling. If we didn't detect the item name let's tell the user
  8. if (intent.Slots.FirstOrDefault(x => x.Key == "ItemName").Value.Value == null)
  9. {
  10. return await BuildSpeechletResponse("Success", "I'm sorry but I wasn't able to understand the name of the task. Say the command again and I will pay closer attention this time.", false);
  11. }
  12. //Add a new card to the board
  13. list.Cards.Add(intent.Slots.FirstOrDefault(x => x.Key == "ItemName").Value.Value.ToString().Humanize(LetterCasing.Title));
  14. //Have Alexa announce that the card has been created.
  15. speechOutput = string.Format("{0}, I've created a new card called {1} and added it to the {2} column on the {3} board. {4}", member.FullName.Split(' ').FirstOrDefault(), intent.Slots.FirstOrDefault().Value.Value.ToString(), list.Name, board,GetRandomCompliment());
  16. var response = await BuildSpeechletResponse("Success", speechOutput, true);
  17. return response;
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement