public async Task HandleRequest()
        {
            await RequestProcessManager.ProcessRequest($"{CustomRequest.NewUserNameIntent}", async() =>
            {
                await Task.Run(async() =>
                {
                    string username = InputManager.GetInputValue(UserNameEntity.Name);
                    string target   = InputManager.GetInputValue(NewUserNameEntity.Name);

                    if (NewUserNameEntity.Values.Contains(target) && !string.IsNullOrWhiteSpace(username))
                    {
                        State.UserName = username;
                        SessionManager.Set(SessionKey.UserMode, UserMode.Profile);
                        Response.SetSession();
                        Response.SetSpeech(false, false,
                                           SpeechManager.GetUpdateUserNameSpeech(username) + SpeechManager.GetFillUpProfileSpeech() + SpeechManager.GetFillUpProfileReprompt(),
                                           SpeechManager.GetWhatWouldYouDoSpeech());
                    }
                    else
                    {
                        await new FallbackIntentHandler().HandleRequest();
                    }
                });
            });
        }
Пример #2
0
        public async Task HandleRequest()
        {
            await RequestProcessManager.ProcessRequest($"{CustomRequest.AnswerIntent}", async() =>
            {
                await Task.Run(() =>
                {
                    string input = InputManager.GetInputValue("AnswerEntity");

                    if (!string.IsNullOrWhiteSpace(input))
                    {
                        if (SessionManager.Get <string>("UserMode") != UserMode.Answer)
                        {
                            int index = SessionManager.Get <int>("Index");

                            Profile profile = State.Profiles[0];
                            Logger.Write(index.ToString());

                            if (profile.Answers == null)
                            {
                                profile.Answers = new List <string>();
                            }

                            profile.Answers.Add(input);

                            index++;

                            SessionManager.Set("Index", index);
                            Response.SetSession();

                            if (index < 5)
                            {
                                Response.SetSpeech(false, true, $"Next question, {profile.Questions[index]}. ");
                            }
                            else
                            {
                                Response.SetSpeech(false, true, "Your profile has been set up. send it to your friend by saying make someone suffer. ", "");
                            }
                        }
                        else
                        {
                            int answerIndex = SessionManager.Get <int>("AnswerIndex");
                            if (input.Contains(State.PendingChallanges[0].Answers[answerIndex]))
                            {
                                answerIndex += 1;
                                SessionManager.Set("AnswerIndex", answerIndex);
                                Response.Response.SetSession();
                                Response.SetSpeech(false, true, $"you got it right, next question {State.PendingChallanges[0].Questions[answerIndex]}", "");
                            }
                            else
                            {
                                answerIndex += 1;
                                SessionManager.Set("AnswerIndex", answerIndex);
                                Response.Response.SetSession();
                                Response.SetSpeech(false, true, $"How dare you got this wrong? you better try your best! Next question, {State.PendingChallanges[0].Questions[answerIndex]}", "");
                            }
                        }
                    }
                });
            });
        }
Пример #3
0
 public async Task HandleRequest()
 {
     await RequestProcessManager.ProcessRequest($"{CustomRequest.CustomIntent}", async() =>
     {
         await Task.Run(() =>
         {
         });
     });
 }
 public async Task HandleRequest()
 {
     await RequestProcessManager.ProcessRequest($"{BuiltInRequest.SessionEndedRequest}", async() =>
     {
         await Task.Run(() =>
         {
             Logger.Write("Session expired");
         });
     });
 }
Пример #5
0
        public async Task HandleRequest()
        {
            await RequestProcessManager.ProcessRequest($"{BuiltInRequest.LaunchRequest}", async() =>
            {
                await Task.Run(() =>
                {
                    State.NumPlayed++;
                    State.NumPrompted = 0;

                    if (string.IsNullOrWhiteSpace(State.UserName))
                    {
                        Response.SetSpeech(false, true,
                                           SpeechManager.GetWelcomeSpeech() + SpeechManager.GetAskForUserNameSpeech() + SpeechManager.GetAskForUserNameReprompt(),
                                           SpeechManager.GetAskForUserNameReprompt());
                    }
                    else
                    {
                        if (State.PendingChallanges.Any())
                        {
                            SessionManager.Set(SessionKey.UserMode, UserMode.Answer);
                            Response.SetSession();
                            Response.SetSpeech(false, true,
                                               $"You have one pending challange to face bryan, are you ready to get wasted? ", "");
                        }
                        else if (State.Profiles == null || !State.Profiles.Any() || State.Profiles.Count < 1)
                        {
                            SessionManager.Set(SessionKey.UserMode, UserMode.Profile);
                            Response.SetSession();
                            Response.SetSpeech(false, true,
                                               SpeechManager.GetWelcomeBackSpeech(State.UserName) + SpeechManager.GetFillUpProfileSpeech() + SpeechManager.GetFillUpProfileReprompt(),
                                               SpeechManager.GetFillUpProfileReprompt());
                        }
                        else if (State.Friends == null || !State.Friends.Any() || State.Friends.Count < 1)
                        {
                        }

                        else
                        {
                        }
                        // you have no challanges today. if you want to send one, please add a friend with the sie digit code.
                        // if you dont have a friend, stop now, go out, and make some friends, then comeback. or say random to get to know someone else
                    }
                });
            });
        }
Пример #6
0
        public async Task HandleRequest()
        {
            await RequestProcessManager.ProcessRequest($"{CustomRequest.SendProfileIntent}", async() =>
            {
                await Task.Run(async() =>
                {
                    State friend = await Database.GetFriend("bryan");

                    if (friend.PendingChallanges == null)
                    {
                        friend.PendingChallanges = new List <Profile>();
                    }

                    friend.PendingChallanges.Add(State.Profiles[0]);

                    await Database.SaveFriend(friend);
                    Response.SetSpeech(false, true, "Your profile has been sent to Bryan. ", "");
                });
            });
        }
Пример #7
0
        public async Task HandleRequest()
        {
            await RequestProcessManager.ProcessRequest($"{BuiltInRequest.YesIntent}", async() =>
            {
                await Task.Run(async() =>
                {
                    if (SessionManager.Contains(SessionKey.UserMode))
                    {
                        string userMode = SessionManager.Get <string>(SessionKey.UserMode);
                        switch (userMode)
                        {
                        case UserMode.Profile:
                            Response.SetSpeech(false, true,
                                               "Okay, profile is a series of questions about you. Later, you will be sending those profiles to your friends to take a challange. " +
                                               "Which relationship to you want to put through the challange?. You can choose family, friends, or lovers. ",
                                               "Which relationship to you want to put through the challange?. You can choose family, friends, or lovers ");
                            break;

                        case UserMode.Answer:
                            SessionManager.Set("AnswerIndex", 0);
                            Response.SetSession();
                            Response.SetSpeech(false, true,
                                               "Okay let's suffer. Question one, A. which game is ayush's best choice? ",
                                               ""
                                               );
                            break;

                        default:
                            await new FallbackIntentHandler().HandleRequest();
                            break;
                        }
                    }
                    else
                    {
                        await new FallbackIntentHandler().HandleRequest();
                    }
                });
            });
        }
Пример #8
0
        public async Task HandleRequest()
        {
            await RequestProcessManager.ProcessRequest($"{BuiltInRequest.FallbackIntent}", async() =>
            {
                await Task.Run(() =>
                {
                    State.NumPrompted++;

                    if (State.NumPrompted % 3 == 0)
                    {
                        Response.SetSpeech(true, false,
                                           SpeechManager.GetExceptionSpeech());
                    }
                    else
                    {
                        Response.SetSpeech(false, false,
                                           SpeechManager.GetNotUnderstandSpeech() + SpeechManager.GetTryAgainSpeech() + SpeechManager.GetWhatWouldYouDoSpeech(),
                                           SpeechManager.GetShortHelpSpeech() + SpeechManager.GetWhatWouldYouDoSpeech());
                    }
                });
            });
        }
Пример #9
0
        public async Task HandleRequest()
        {
            await RequestProcessManager.ProcessRequest($"{CustomRequest.SetProfileModeIntent}", async() =>
            {
                await Task.Run(() =>
                {
                    string input = InputManager.GetInputValue(ProfileModeEntity.Name);

                    if (!string.IsNullOrWhiteSpace(input) && ProfileModeEntity.Values.Contains(input))
                    {
                        Profile profile = new Profile
                        {
                            Mode      = input,
                            Name      = State.UserName,
                            Questions = new List <string> {
                                "A. Which game is your best choice? ",
                                "B. Who is your most hated person? ",
                                "C. What is your favorite food? ",
                                "D. What is your favorite paper? ",
                                "E. Who is your favorite hero? "
                            },
                            Answers = new List <string>()
                            {
                            }
                        };

                        SessionManager.Set("Index", 0);
                        Response.SetSession();
                        Logger.Write(JsonConvert.SerializeObject(profile));

                        State.Profiles.Add(profile);

                        Response.SetSpeech(false, true, $"Okay, you have chosen {input} mode. The first question, {profile.Questions[0]}. ", "");
                    }
                });
            });
        }