Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if("CreateItem".Equals(intentName))
- {
- //Get our Trello Board
- var board = GetBoard(intent, member);
- //Get the first list from the board
- var list = board.Lists.FirstOrDefault();
- //Do some whimiscal error handling. If we didn't detect the item name let's tell the user
- if (intent.Slots.FirstOrDefault(x => x.Key == "ItemName").Value.Value == null)
- {
- 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);
- }
- //Add a new card to the board
- list.Cards.Add(intent.Slots.FirstOrDefault(x => x.Key == "ItemName").Value.Value.ToString().Humanize(LetterCasing.Title));
- //Have Alexa announce that the card has been created.
- 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());
- var response = await BuildSpeechletResponse("Success", speechOutput, true);
- return response;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement