private SkillResponse ErrorResponse(Exception exc = null) { if (exc != null) { LogMessage(exc.Message, SeverityLevel.Error, new Dictionary <string, string>() { { "Stack Trace", exc.StackTrace } }); } var util = new Utils(); // build the speech response var speech = new Alexa.NET.Response.SsmlOutputSpeech(); speech.Ssml = $"<speak>{util.GetRandomMessage(Globals.IDidntUnderstand, false)}. Try saying 'What are today's threats' to list today's threats.</speak>"; // create the speech reprompt var repromptMessage = new Alexa.NET.Response.PlainTextOutputSpeech(); repromptMessage.Text = "Try saying 'What are today's threats' to list today's threats."; // create the reprompt var reprompt = new Alexa.NET.Response.Reprompt(); reprompt.OutputSpeech = repromptMessage; // create the response using the ResponseBuilder var finalResponse = ResponseBuilder.Ask(speech, reprompt); return(finalResponse); }
private SkillResponse ResponseReprompt(string text, string reprompt) { var speech = new Alexa.NET.Response.SsmlOutputSpeech(); speech.Ssml = "<speak> " + text + " </speak>"; var repromptMessage = new Alexa.NET.Response.PlainTextOutputSpeech(); repromptMessage.Text = "<speak> " + reprompt + " </speak>"; // create the reprompt var repromptBody = new Alexa.NET.Response.Reprompt(); repromptBody.OutputSpeech = repromptMessage; var finalResponse = ResponseBuilder.Ask(speech, repromptBody); return(finalResponse); }
/// <summary> /// Gives a response of all the valid pack types /// </summary> /// <returns>All the valid pack types as a spoken response</returns> public SkillResponse GetPackTypesReponse() { var speech = new Alexa.NET.Response.PlainTextOutputSpeech() { Text = "The pack types are Saviors of Uldum, Rise of Shadows, Rastakhan's Rumble, The Boomsday Project, The Witchwood, Kobolds and Catacombs, Knights of the Frozen Throne, Journey to Un'goro, " + "Mean Streets of Gadgetzan, Whispers of the Old Gods, The Grand Tournament, Goblins Versus Gnomes and the Classic Set." }; var reprompt = new Reprompt() { OutputSpeech = new PlainTextOutputSpeech() { Text = "You can now say 'I opened X packs of Pack Type'." } }; return(ResponseBuilder.Ask(speech, reprompt)); }
/// <summary> /// Gievs help to the user with some sample phrases /// </summary> /// <returns>Sample phrases as a spoken response</returns> public SkillResponse GetHelpResponse() { var speech = new Alexa.NET.Response.PlainTextOutputSpeech() { Text = "This is a skill to track the number of packs you open in the digital card game Hearthstone. " + "You can say 'I opened X packs of Pack Type' or " + "'I opened a pack of Pack type and got X legendary cards'. For a list of valid pack types say " + "'What are the valid pack types'." }; var reprompt = new Reprompt() { OutputSpeech = new PlainTextOutputSpeech() { Text = "Say 'I opened X packs of Pack Type'." } }; return(ResponseBuilder.Ask(speech, reprompt)); }
private SkillResponse FallbackHelp() { // create the speech response - cards still need a voice response var speech = new Alexa.NET.Response.SsmlOutputSpeech(); speech.Ssml = $"<speak>{_util.GetRandomMessage(Globals.IDidntUnderstand)}. You might try 'What are today's threats?'</speak>"; // create the speech reprompt var repromptMessage = new Alexa.NET.Response.PlainTextOutputSpeech(); repromptMessage.Text = "Try saying 'What are today's threats?'"; // create the reprompt var repromptBody = new Alexa.NET.Response.Reprompt(); repromptBody.OutputSpeech = repromptMessage; var finalResponse = ResponseBuilder.Ask(speech, repromptBody); return(finalResponse); }
private SkillResponse Help() { // create the speech response - cards still need a voice response var speech = new Alexa.NET.Response.SsmlOutputSpeech(); speech.Ssml = $"<speak>Do you worry about space-based threats to earth such as asteroids and other near earth objects? {Globals.FriendlyAppTitle} will let you know what's out there zooming towards us.</speak>"; // create the speech reprompt var repromptMessage = new Alexa.NET.Response.PlainTextOutputSpeech(); repromptMessage.Text = "Try saying 'What are today's threats?'"; // create the reprompt var repromptBody = new Alexa.NET.Response.Reprompt(); repromptBody.OutputSpeech = repromptMessage; var finalResponse = ResponseBuilder.Ask(speech, repromptBody); return(finalResponse); }
private SkillResponse Usage() { var commonUsage = "You can say 'What are today's threats?' to list today's space-based threats to earth, or say Help to get more information."; // create the speech response - cards still need a voice response var speech = new Alexa.NET.Response.SsmlOutputSpeech(); speech.Ssml = $"<speak>Welcome to {Globals.FriendlyAppTitle}. {commonUsage}</speak>"; // create the speech reprompt var repromptMessage = new Alexa.NET.Response.PlainTextOutputSpeech(); repromptMessage.Text = commonUsage; // create the reprompt var repromptBody = new Alexa.NET.Response.Reprompt(); repromptBody.OutputSpeech = repromptMessage; var finalResponse = ResponseBuilder.Ask(speech, repromptBody); return(finalResponse); }
public SkillResponse FunctionHandler(SkillRequest input, ILambdaContext context) { // your function logic goes here // check what type of a request it is like an IntentRequest or a LaunchRequest var requestType = input.GetRequestType(); if (requestType == typeof(IntentRequest)) { var intentRequest = input.Request as IntentRequest; var responseBodyIntent = new Alexa.NET.Response.ResponseBody(); var speechIntent = new Alexa.NET.Response.PlainTextOutputSpeech(); var skillResponseIntent = new Alexa.NET.Response.SkillResponse(); // check the name to determine what you should do if (intentRequest.Intent.Name.Equals("umbracoRootknoten")) { var informationsIntent = GetUmbracoRootNode().Result.Replace("\"", ""); speechIntent.Text = informationsIntent; // create the response responseBodyIntent.OutputSpeech = speechIntent; responseBodyIntent.ShouldEndSession = true; // this triggers the reprompt skillResponseIntent.Response = responseBodyIntent; skillResponseIntent.Version = "1.0"; return(skillResponseIntent); } if (intentRequest.Intent.Name.Equals("erstelleUmbracoRootknoten")) { var number = intentRequest.Intent.Slots["rootknotenalias"].Value; if (number != null) { var informationsIntent = CreateNode(number).Result.Replace("\"", ""); speechIntent.Text = informationsIntent; responseBodyIntent.OutputSpeech = speechIntent; responseBodyIntent.ShouldEndSession = true; // this triggers the reprompt skillResponseIntent.Response = responseBodyIntent; skillResponseIntent.Version = "1.0"; return(skillResponseIntent); } speechIntent.Text = "Ungültig Eingabe Sie Vollidiot!"; responseBodyIntent.OutputSpeech = speechIntent; responseBodyIntent.ShouldEndSession = true; // this triggers the reprompt skillResponseIntent.Response = responseBodyIntent; skillResponseIntent.Version = "1.0"; return(skillResponseIntent); } } else if (requestType == typeof(Alexa.NET.Request.Type.LaunchRequest)) { // default launch path executed } else if (requestType == typeof(AudioPlayerRequest)) { // do some audio response stuff } var speech = new Alexa.NET.Response.PlainTextOutputSpeech(); var informations = GetUmbracoString().Result.Replace("\"", ""); speech.Text = informations; // create the response var responseBody = new Alexa.NET.Response.ResponseBody(); responseBody.OutputSpeech = speech; responseBody.ShouldEndSession = true; // this triggers the reprompt var skillResponse = new Alexa.NET.Response.SkillResponse(); skillResponse.Response = responseBody; skillResponse.Version = "1.0"; return(skillResponse); }
/// <summary> /// Processes the intent of Current Count /// </summary> /// <returns>A response of the pack type with the most packs purchaced without a legendary</returns> public async Task <SkillResponse> GetCurrentCountResponse(string userId) { var user = await hearthDBHelper.GetPacks(userId); var maxCount = 0; var maxPackType = "Classic"; if (maxCount < user.Pack.ClassicCount) { maxCount = user.Pack.ClassicCount; maxPackType = "Classic"; } if (maxCount < user.Pack.WitchwoodCount) { maxCount = user.Pack.WitchwoodCount; maxPackType = "Witch wood"; } if (maxCount < user.Pack.WitchwoodCount) { maxCount = user.Pack.WitchwoodCount; maxPackType = "Witch wood"; } if (maxCount < user.Pack.WitchwoodCount) { maxCount = user.Pack.WitchwoodCount; maxPackType = "Witch wood"; } if (maxCount < user.Pack.WitchwoodCount) { maxCount = user.Pack.WitchwoodCount; maxPackType = "Witch wood"; } if (maxCount < user.Pack.WitchwoodCount) { maxCount = user.Pack.WitchwoodCount; maxPackType = "Witch wood"; } if (maxCount < user.Pack.FrozenThroneCount) { maxCount = user.Pack.FrozenThroneCount; maxPackType = "Frozen Throne"; } if (maxCount < user.Pack.GadgetzanCount) { maxCount = user.Pack.GadgetzanCount; maxPackType = "Gadgetzan"; } if (maxCount < user.Pack.GVGCount) { maxCount = user.Pack.GVGCount; maxPackType = "Goblins Versus Gnomes"; } if (maxCount < user.Pack.KoboldsCount) { maxCount = user.Pack.KoboldsCount; maxPackType = "Kobolds and Catacombs"; } if (maxCount < user.Pack.OldGodsCount) { maxCount = user.Pack.OldGodsCount; maxPackType = "Whispers of the Old Gods"; } if (maxCount < user.Pack.TGTCount) { maxCount = user.Pack.TGTCount; maxPackType = "The Grand Tourament"; } if (maxCount < user.Pack.UnGoroCount) { maxCount = user.Pack.UnGoroCount; maxPackType = "Journey to Un'Goro"; } maxCount = (MAX_PACKS - maxCount) < 0 ? 1 : (MAX_PACKS - maxCount); var speech = new Alexa.NET.Response.PlainTextOutputSpeech() { Text = string.Format("You are closest to a legendary in the {0} set with at most {1} packs remaining.", maxPackType, maxCount) }; return(ResponseBuilder.Tell(speech)); }
public Reprompt(string text) { OutputSpeech = new PlainTextOutputSpeech { Text = text }; }