Example #1
0
        public SkillResponse HelpIntent(SkillRequest input, ILambdaContext context, SkillResource resource)
        {
            var response = new SkillResponse
            {
                Response = new ResponseBody {
                    ShouldEndSession = false, Reprompt = new Reprompt()
                }
            };
            var log = context.Logger;


            //Setting Speech Response
            IOutputSpeech innerSpeechResponse         = new PlainTextOutputSpeech();
            IOutputSpeech innerSpeechResponseReprompt = new PlainTextOutputSpeech();

            if (resource != null)
            {
                //Set Speech Response
                ((PlainTextOutputSpeech)innerSpeechResponse).Text = resource.HelpMessage;
                //Set Reprompt Response
                ((PlainTextOutputSpeech)innerSpeechResponseReprompt).Text =
                    resource.StandardReprompt;

                //Setting Card Response
                var card = SetStandardCard("Accrington Academy Help", resource.HelpMessage,
                                           SetCardImage(
                                               "https://raw.githubusercontent.com/fuzzysb/Accrington-Academy/master/Accrington-Academy/AccringtonAcademy-Small.png",
                                               "https://raw.githubusercontent.com/fuzzysb/Accrington-Academy/master/Accrington-Academy/AccringtonAcademy-Large.png"));
                response.Response.Card = card;
            }

            response.Response.OutputSpeech          = innerSpeechResponse;
            response.Response.Reprompt.OutputSpeech = innerSpeechResponseReprompt;
            response.Version = "1.0";
            log.LogLine("Skill Response Object...");
            log.LogLine(JsonConvert.SerializeObject(response));
            return(response); //return the skill response back to the main function
        }
        public List <SkillResource> GetAllResources()
        {
            List <SkillResource> resources = new List <SkillResource>();

            SkillResource enGbResource = new SkillResource("en-GB")
            {
                SkillName   = "Accrington Academy",
                HelpMessage =
                    "You can ask which week it is, and alexa will tell you if it is week 1 or week 2, or you can say Stop or Cancel to exit this skill",
                LaunchMessage =
                    "Welcome to Accrington Academy, do you want to know what week it is?",
                StopMessage =
                    "Goodbye, have a good day at school.",
                StandardReprompt =
                    "do you want to know what week it is?"
            };

            resources.Add(enGbResource);

            SkillResource enUsResource = new SkillResource("en-US")
            {
                SkillName   = "Accrington Academy",
                HelpMessage =
                    "You can ask which week it is, and alexa will tell you if it is week 1 or week 2, or you can say Stop or Cancel to exit this skill",
                LaunchMessage =
                    "Welcome to Accrington Academy, do you want to know what week it is?",
                StopMessage =
                    "Goodbye, have a good day at school.",
                StandardReprompt =
                    "do you want to know what week it is?"
            };

            resources.Add(enUsResource);

            SkillResource enCaResource = new SkillResource("en-CA")
            {
                SkillName   = "Accrington Academy",
                HelpMessage =
                    "You can ask which week it is, and alexa will tell you if it is week 1 or week 2, or you can say Stop or Cancel to exit this skill",
                LaunchMessage =
                    "Welcome to Accrington Academy, do you want to know what week it is?",
                StopMessage =
                    "Goodbye, have a good day at school.",
                StandardReprompt =
                    "do you want to know what week it is?"
            };

            resources.Add(enCaResource);

            SkillResource enAuResource = new SkillResource("en-AU")
            {
                SkillName   = "Accrington Academy",
                HelpMessage =
                    "You can ask which week it is, and alexa will tell you if it is week 1 or week 2, or you can say Stop or Cancel to exit this skill",
                LaunchMessage =
                    "Welcome to Accrington Academy, do you want to know what week it is?",
                StopMessage =
                    "Goodbye, have a good day at school.",
                StandardReprompt =
                    "do you want to know what week it is?"
            };

            resources.Add(enAuResource);

            SkillResource enInResource = new SkillResource("en-IN")
            {
                SkillName   = "Accrington Academy",
                HelpMessage =
                    "You can ask which week it is, and alexa will tell you if it is week 1 or week 2, or you can say Stop or Cancel to exit this skill",
                LaunchMessage =
                    "Welcome to Accrington Academy, do you want to know what week it is?",
                StopMessage =
                    "Goodbye, have a good day at school.",
                StandardReprompt =
                    "do you want to know what week it is?"
            };

            resources.Add(enInResource);

            return(resources);
        }
Example #3
0
        public SkillResponse CancelIntent(SkillRequest input, ILambdaContext context, SkillResource resource)
        {
            var log = context.Logger;
            SkillResponse
                response = new SkillResponse
            {
                Response = new ResponseBody {
                    ShouldEndSession = true
                }
            };     //sets up the skill speech response format


            //Setting Speech Response
            IOutputSpeech innerSpeechResponse = new PlainTextOutputSpeech();

            if (resource != null)
            {
                //Setting Speech Response
                ((PlainTextOutputSpeech)innerSpeechResponse).Text = resource.StopMessage;
                // Setting App Card
                var card = SetStandardCard("GoodBye", resource.StopMessage,
                                           SetCardImage(
                                               "https://raw.githubusercontent.com/fuzzysb/Accrington-Academy/master/Accrington-Academy/AccringtonAcademy-Small.png",
                                               "https://raw.githubusercontent.com/fuzzysb/Accrington-Academy/master/Accrington-Academy/AccringtonAcademy-Large.png"));
                response.Response.Card = card;
            }

            //Add Speech
            response.Response.OutputSpeech = innerSpeechResponse;
            response.Version = "1.0";
            log.LogLine("Skill Response Object...");
            log.LogLine(JsonConvert.SerializeObject(response));
            return(response);
        }
        public SkillResponse TimeTableIntent(SkillRequest input, ILambdaContext context, SkillResource resource)
        {
            var log = context.Logger;

            log.LogLine("In TimeTableIntent");
            log.LogLine("Setting up Skill Response");
            var response = new SkillResponse
            {
                Response = new ResponseBody {
                    ShouldEndSession = true
                }
            };
            int week1Matches;
            int week2Matches;

            try
            {
                week1Matches = (Regex.Matches(HomePage, ".*week 1.*")).Count;
                week2Matches = (Regex.Matches(HomePage, ".*week 2.*")).Count;
            }
            catch
            {
                week1Matches = 0;
                week2Matches = 0;
                //ignored
            }

            var resultText = "";

            try
            {
                if (week1Matches > week2Matches)
                {
                    log.LogLine("Week 1 Evaluated");
                    resultText = "This Week it is: Week 1 - Orange";
                }
                else if (week2Matches > week1Matches)
                {
                    log.LogLine("Week 1 Evaluated");
                    resultText = "This Week it is: Week 2 - Purple";
                }
                else
                {
                    log.LogLine("Cannot Evaluate the Week");
                    resultText = "I am Sorry i do not know what week it is, please try again later";
                }
            }
            catch
            {
                log.LogLine("Cannot Evaluate the Week");
                resultText = "I am Sorry i do not know what week it is, please try again later";
            }


            //The device does not have a Scren so runs the following code block
            //Setting Welcome Speech Response
            IOutputSpeech innerSpeechResponse = new PlainTextOutputSpeech();


            ((PlainTextOutputSpeech)innerSpeechResponse).Text = resultText;

            //Setting Card Response
            log.LogLine("Setting up the Card Response");
            var card = SetStandardCard(@"Accrington Academy TimeTable", resultText,
                                       SetCardImage(
                                           "https://raw.githubusercontent.com/fuzzysb/Accrington-Academy/master/Accrington-Academy/AccringtonAcademy-Small.png",
                                           "https://raw.githubusercontent.com/fuzzysb/Accrington-Academy/master/Accrington-Academy/AccringtonAcademy-Large.png"));

            response.Response.Card = card;


            response.Response.OutputSpeech = innerSpeechResponse;
            response.Version = "1.0";
            log.LogLine("Skill Response Object...");
            log.LogLine(JsonConvert.SerializeObject(response));
            return(response);
        }
        public SkillResponse LaunchIntent(SkillRequest input, ILambdaContext context, SkillResource resource)
        {
            var log = context.Logger;

            log.LogLine("In Insult Intent");
            log.LogLine("Setting up Skill Response");
            var response = new SkillResponse
            {
                Response = new ResponseBody {
                    ShouldEndSession = false, Reprompt = new Reprompt()
                }
            };


            //The device does not have a Scren so runs the following code block
            //Setting Welcome Speech Response
            IOutputSpeech innerSpeechResponse         = new PlainTextOutputSpeech();
            IOutputSpeech innerSpeechResponseReprompt = new PlainTextOutputSpeech();

            if (resource != null)
            {
                ((PlainTextOutputSpeech)innerSpeechResponse).Text         = resource.LaunchMessage;
                ((PlainTextOutputSpeech)innerSpeechResponseReprompt).Text = resource.StandardReprompt;

                //Setting Card Response
                //Setting Card Response
                log.LogLine("Setting up the Card Response");
                var card = SetStandardCard(@"Accrington Academy TimeTable", resource.LaunchMessage,
                                           SetCardImage(
                                               "https://raw.githubusercontent.com/fuzzysb/Accrington-Academy/master/Accrington-Academy/AccringtonAcademy-Small.png",
                                               "https://raw.githubusercontent.com/fuzzysb/Accrington-Academy/master/Accrington-Academy/AccringtonAcademy-Large.png"));
                response.Response.Card = card;
            }


            response.Response.OutputSpeech          = innerSpeechResponse;
            response.Response.Reprompt.OutputSpeech = innerSpeechResponseReprompt;
            response.Version = "1.0";
            log.LogLine("Skill Response Object...");
            log.LogLine(JsonConvert.SerializeObject(response));
            return(response);
        }