public SkillResponse FunctionHandler(SkillRequest input, ILambdaContext context) { IOutputSpeech innerResponse = null; var log = context.Logger; var shouldEndSession = false; if (input.GetRequestType() == typeof(ILaunchRequest)) { // default launch request, let's just let them know what you can do log.LogLine("Default LaunchRequest made"); // grab the existing game if there is one var currentGame = _dealer.FindGame(input.Session.User.UserId); if (currentGame != null) { innerResponse = new PlainTextOutputSpeech { Text = $"Welcome back to Red or Black. Your current game has {currentGame.cardsRemainingCount} cards remaining with a score of {currentGame.score}. You can either continue this game by making a guess, or ask me to start a new game." }; } else { innerResponse = new PlainTextOutputSpeech { Text = "Welcome to Red or Black. Ask me to start a game with you." }; } } else if (input.GetRequestType() == typeof(IIntentRequest)) { // intent request, process the intent log.LogLine($"Intent Requested {input.Request.Intent.Name}"); switch (input.Request.Intent.Name) { case "NewGameIntent": innerResponse = StartNewGame(input.Session.User.UserId); break; case "GuessTheCardIntent": innerResponse = CheckGuess(input.Session.User.UserId, input.Request.Intent.Slots); break; case "AMAZON.StopIntent": innerResponse = new PlainTextOutputSpeech { Text = "Goodbye. Thanks for playing" }; shouldEndSession = true; break; default: innerResponse = new PlainTextOutputSpeech { Text = "Hmm, something went wrong. Try again" }; break; } } var response = new Response { ShouldEndSession = shouldEndSession, OutputSpeech = innerResponse }; var skillResponse = new SkillResponse { Response = response, Version = "1.0" }; return(skillResponse); }