private static SkillResponse HandleFlashCard(string flashCardWord, string output, string reprompt) { string reprompSpeech = StartTag + reprompt + EndTag; string speech = StartTag + output + EndTag; SkillResponse response = new SkillResponse { Version = "1.1" }; var directive = AlexaResponse.Create_DynamicEntityDirective(flashCardWord); ResponseBody body = new ResponseBody { ShouldEndSession = false, OutputSpeech = new SsmlOutputSpeech(speech), Reprompt = new Reprompt() { OutputSpeech = new SsmlOutputSpeech(reprompSpeech) } }; response.Response = body; response.Response.Directives.Add(directive); response.SessionAttributes = sessionAttributes.ToDictionary(); if (DisplaySupported) { var displayDirective = _alexaDisplay.GetCurrentWordDirective(flashCardWord); response.Response.Directives.Add(displayDirective); } return(response); }
public static SkillResponse Introduction(string introduction, string reprompt) { string intro = StartTag + introduction + EndTag; var response = AlexaResponse.SayWithReprompt(new SsmlOutputSpeech(intro), reprompt); if (DisplaySupported) { response.Response.Directives.Add(_alexaDisplay.GetIntroDirective()); } response.SessionAttributes = sessionAttributes.ToDictionary(); return(response); }
public async Task <SkillResponse> FunctionHandler(SkillRequest request, ILambdaContext context) { string requestType = request.Request.Type; LOGGER.log = MoycaLogger.GetLogger(context, LogLevel.TRACE); AlexaResponse.SetDisplaySupported(request.APLSupported()); LogSessionStart(request); switch (requestType) { case "LaunchRequest": LOGGER.log.DEBUG("Function", "Launch Request"); response = await new LaunchRequest(request).HandleRequest(); break; case "IntentRequest": LOGGER.log.DEBUG("Function", "Intent Request"); response = await new IntentRequest(request).HandleRequest(); break; case "SessionEndedRequest": LOGGER.log.DEBUG("Function", "Session Ended Request"); response = await new SessionEnded().HandleRequest(); break; case "Connections.Response": LOGGER.log.DEBUG("Function", "Connection Response "); response = await new Connection(request).HandleRequest(); break; default: LOGGER.log.DEBUG("Function", "Default Error Request"); response = AlexaResponse.Say("Error"); break; } return(response); }