public List <FactResource> GetResources() { List <FactResource> resources = new List <FactResource>(); FactResource enUSResource = new FactResource("en-US"); enUSResource.SkillName = "Sicomob facts"; enUSResource.GetFactMessage = "Here's your insight "; enUSResource.HelpMessage = "You can say tell me a smart connected mobility insight, or, you can say exit... What can I help you with?"; enUSResource.HelpReprompt = "You can say tell me a smart connected mobility insight to start"; enUSResource.StopMessage = "Goodbye!"; enUSResource.Facts.Add(this.GetDrivingPatternAsync().Result); //enUSResource.Facts.Add("A year on Mercury is just 88 days long."); //enUSResource.Facts.Add("Despite being farther from the Sun, Venus experiences higher temperatures than Mercury."); //enUSResource.Facts.Add("Venus rotates counter-clockwise, possibly because of a collision in the past with an asteroid."); //enUSResource.Facts.Add("On Mars, the Sun appears about half the size as it does on Earth."); //enUSResource.Facts.Add("Earth is the only planet not named after a god."); //enUSResource.Facts.Add("Jupiter has the shortest day of all the planets."); //enUSResource.Facts.Add("The Milky Way galaxy will collide with the Andromeda Galaxy in about 5 billion years."); //enUSResource.Facts.Add("The Sun contains 99.86% of the mass in the Solar System."); //enUSResource.Facts.Add("The Sun is an almost perfect sphere."); //enUSResource.Facts.Add("A total solar eclipse can happen once every 1 to 2 years. This makes them a rare event."); //enUSResource.Facts.Add("Saturn radiates two and a half times more energy into space than it receives from the sun."); //enUSResource.Facts.Add("The temperature inside the Sun can reach 15 million degrees Celsius."); //enUSResource.Facts.Add("The Moon is moving approximately 3.8 cm away from our planet every year."); resources.Add(enUSResource); return(resources); }
public List <FactResource> GetResources() { List <FactResource> resources = new List <FactResource>(); FactResource frFRResource = new FactResource("fr-FR"); frFRResource.SkillName = "Anecdotes spatiales"; frFRResource.GetFactMessage = "Voici une anecdote spatiale : "; frFRResource.HelpMessage = "Alexa, lance anecdote spatiale et dis-moi un fait spatial"; frFRResource.HelpReprompt = "Alexa, commence anecdote spatiale et donne-moi un fait spatial"; frFRResource.StopMessage = "Au revoir !"; frFRResource.Facts.Add("Une année sur Mercure ne dure que 88 jours."); frFRResource.Facts.Add("Bien qu'elle soit plus éloignée du Soleil, Vénus connaît des températures plus élevées que Mercure."); frFRResource.Facts.Add("Vénus tourne dans le sens inverse des aiguilles d'une montre, peut-être à cause d'une collision passée avec un astéroïde."); frFRResource.Facts.Add("Sur Mars, le Soleil apparaît à peu près deux fois moins grand que sur Terre."); frFRResource.Facts.Add("La Terre est la seule planète qui ne porte pas le nom d'un dieu."); frFRResource.Facts.Add("Jupiter a le jour le plus court de toutes les planètes."); frFRResource.Facts.Add("La Voie lactée entrera en collision avec la galaxie d'Andromède dans environ 5 milliards d'années."); frFRResource.Facts.Add("Le Soleil contient 99,86 % de la masse du système solaire."); frFRResource.Facts.Add("Le Soleil est une sphère presque parfaite."); frFRResource.Facts.Add("Une éclipse solaire totale peut se produire une fois tous les 1 à 2 ans. Cela en fait un événement rare."); frFRResource.Facts.Add("Saturne rayonne deux fois et demie plus d'énergie dans l'espace qu'elle n'en reçoit du soleil."); frFRResource.Facts.Add("La température à l'intérieur du Soleil peut atteindre 15 millions de degrés Celsius."); frFRResource.Facts.Add("La Lune s'éloigne d'environ 3,8 cm de notre planète chaque année."); resources.Add(frFRResource); return(resources); }
public string emitNewFact(FactResource resource, bool withPreface) { Random r = new Random(); if (withPreface) { return(resource.Facts[r.Next(resource.Facts.Count)]); } return(resource.Facts[r.Next(resource.Facts.Count)]); }
public static string EmitNewFact(FactResource resource, bool withPreface) { Random r = new Random(); if (withPreface) { return(resource.GetFactMessage + resource.Facts[r.Next(resource.Facts.Count)]); } else { return(resource.Facts[r.Next(resource.Facts.Count)]); } }
public List <FactResource> GetResources() { List <FactResource> resources = new List <FactResource>(); FactResource enUSResource = new FactResource("en-GB") { SkillName = "Kerv", WelcomeMessage = "Hi, ask Kerv what your balance is", HelpMessage = "You can say .. Ask Kerv what my balance is?", HelpReprompt = "You can say what is my current balance", StopMessage = "Goodbye!" }; resources.Add(enUSResource); return(resources); }
public static List <FactResource> GetResources() { List <FactResource> resources = new List <FactResource>(); FactResource enUSResource = new FactResource("en-US"); enUSResource.SkillName = "American Science Facts"; enUSResource.GetFactMessage = "Here's your science fact: "; enUSResource.HelpMessage = "You can say tell me a science fact, or, you can say exit... What can I help you with?"; enUSResource.HelpReprompt = "You can say tell me a science fact to start"; enUSResource.StopMessage = "Goodbye!"; enUSResource.Facts = GetFacts(); resources.Add(enUSResource); return(resources); }
public SkillResponse FunctionHandler(SkillRequest input, ILambdaContext context) { SkillResponse response = new SkillResponse(); response.Response = new ResponseBody(); response.Response.ShouldEndSession = false; IOutputSpeech innerResponse = null; ILambdaLogger log = context.Logger; log.LogLine($"Skill Request Object:"); log.LogLine(JsonConvert.SerializeObject(input)); List <FactResource> allResources = GetResources(); FactResource resource = allResources.FirstOrDefault(); if (input.GetRequestType() == typeof(LaunchRequest)) { log.LogLine($"Default LaunchRequest made: 'Alexa, open Science Facts"); innerResponse = new PlainTextOutputSpeech(); (innerResponse as PlainTextOutputSpeech).Text = EmitNewFact(resource, true); } else if (input.GetRequestType() == typeof(IntentRequest)) { IntentRequest intentRequest = (IntentRequest)input.Request; switch (intentRequest.Intent.Name) { case "AMAZON.CancelIntent": log.LogLine($"AMAZON.CancelIntent: send StopMessage"); innerResponse = new PlainTextOutputSpeech(); (innerResponse as PlainTextOutputSpeech).Text = resource.StopMessage; response.Response.ShouldEndSession = true; break; case "AMAZON.StopIntent": log.LogLine($"AMAZON.StopIntent: send StopMessage"); innerResponse = new PlainTextOutputSpeech(); (innerResponse as PlainTextOutputSpeech).Text = resource.StopMessage; response.Response.ShouldEndSession = true; break; case "AMAZON.HelpIntent": log.LogLine($"AMAZON.HelpIntent: send HelpMessage"); innerResponse = new PlainTextOutputSpeech(); (innerResponse as PlainTextOutputSpeech).Text = resource.HelpMessage; break; case "GetFactIntent": log.LogLine($"GetFactIntent sent: send new fact"); innerResponse = new PlainTextOutputSpeech(); (innerResponse as PlainTextOutputSpeech).Text = EmitNewFact(resource, false); break; case "GetNewFactIntent": log.LogLine($"GetFactIntent sent: send new fact"); innerResponse = new PlainTextOutputSpeech(); (innerResponse as PlainTextOutputSpeech).Text = EmitNewFact(resource, false); break; default: log.LogLine($"Unknown intent: " + intentRequest.Intent.Name); innerResponse = new PlainTextOutputSpeech(); (innerResponse as PlainTextOutputSpeech).Text = resource.HelpReprompt; break; } } response.Response.OutputSpeech = innerResponse; response.Version = "1.0"; log.LogLine($"Skill Response Object..."); log.LogLine(JsonConvert.SerializeObject(response)); return(response); }