public async Task Music(IDialogContext context, LuisResult result)
        {
            QureyController qc  = new QureyController();
            string          ans = "";

            qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0");
            if (result.TopScoringIntent.Score < 0.3)
            {
                ans = qc.GetTrainedAnswer(result.Query);
                await context.PostAsync(ans);

                qc.PostAnswerOne(ans, result.TopScoringIntent.Intent);
                context.Wait(MessageReceived);
            }
            else
            {
                bool     found           = false;
                string[] matching_words1 = { "like" };
                string[] matching_words2 = { "make", "create", "play" };
                string[] matching_words3 = { "you" };

                string tr_ans = qc.GetTrainedAnswer(result.Query);

                if (!string.IsNullOrEmpty(tr_ans))
                {
                    ans   = tr_ans;
                    found = true;
                }
                else if (FindMatchingString.findMatchingString(result.Query, matching_words1))
                {
                    ans   = "Well I can say that I do :D ";
                    found = true;
                }
                else if (FindMatchingString.findMatchingString(result.Query, matching_words2))
                {
                    ans = "Hmmm well listen to this... DO RE MI .... FA SO LAAAAAaaaaaaaa... How did that sound xD ";
                }
                else if (FindMatchingString.findMatchingString(result.Query, matching_words3))
                {
                    ans   = "Well music is always fun. :) ";
                    found = true;
                }
                else
                {
                    var options      = new MovieChoice[] { MovieChoice.PopularMovie, MovieChoice.SearchMovie };
                    var descriptions = new string[] { "Popular Movies", "Search for movie" };
                    PromptDialog.Choice <MovieChoice>(context, ResumeAfterMovieChoiceSelection,
                                                      options, "What would you like to choose about movies?", descriptions: descriptions);
                }
                if (found)
                {
                    await context.PostAsync(ans);

                    context.Wait(MessageReceived);
                }

                qc.PostAnswerOne(ans, result.TopScoringIntent.Intent);
                context.Call(new BingWikiSearchDialog(), this.ResumeAfterOptionDialog);
            }
        }
        public async Task Help(IDialogContext context, LuisResult result)
        {
            QureyController qc = new QureyController();

            qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0");

            if (result.TopScoringIntent.Score < 0.4)
            {
                string ans = "";
                ans = qc.GetTrainedAnswer(result.Query);

                qc.PostAnswerOne(ans, result.TopScoringIntent.Intent);

                await context.PostAsync(ans);

                context.Wait(MessageReceived);
            }
            else
            {
                var options = new UserChoice[]
                {
                    UserChoice.SearchWiki, UserChoice.Weather, UserChoice.PopularMovie, UserChoice.SearchMovie,
                    UserChoice.Game, UserChoice.Train
                };
                var descriptions = new string[]
                {
                    "Search Wikipedia", "Get Weather Info", "Popular Movies", "Search for movie", "Play Game",
                    "Train Me"
                };
                PromptDialog.Choice <UserChoice>(context, ResumeAfterDialogChoiceSelection,
                                                 options, "You asked for help, well here are some of main topics you can find here...",
                                                 descriptions: descriptions);
            }
        }
        public async Task MovieSearch(IDialogContext context, LuisResult result_luis)
        {
            QureyController qc  = new QureyController();
            string          ans = "";

            qc.PostQuestionOne(result_luis.Query, result_luis.TopScoringIntent.Intent, result_luis.TopScoringIntent.Score.ToString(), "0");
            if (result_luis.TopScoringIntent.Score < 0.4)
            {
                ans = qc.GetTrainedAnswer(result_luis.Query);
                qc.PostAnswerOne(ans, result_luis.TopScoringIntent.Intent);
                await context.PostAsync(ans);

                context.Wait(MessageReceived);
            }
            else
            {
                string entity = "";

                if (result_luis.Entities.Count > 0)
                {
                    entity = result_luis.Entities[0].Entity;
                }

                if (entity == "")
                {
                    entity = "Star Wars: The Last Jedi";
                    await context.PostAsync("Here is a movie which i found : ");
                }
                try
                {
                    MoviesSearch search      = new MoviesSearch();
                    Movie        movieResult = await search.SearchByName(entity);

                    if (movieResult.id != 0)
                    {
                        CardUtil.showHeroCard((IMessageActivity)context.Activity, movieResult);
                        ans = movieResult.Title;
                    }
                    else
                    {
                        await context.PostAsync($"I couldn't find a movie :0");
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine($"Error when filtering by genre: {e}");
                }

                qc.PostAnswerOne(ans, result_luis.TopScoringIntent.Intent);
                context.Done <object>(null);
            }
        }
        public async Task WhoIsQuestion(IDialogContext context, IAwaitable <IMessageActivity> activity,
                                        LuisResult result)
        {
            QureyController qc = new QureyController();

            qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0");

            if (result.TopScoringIntent.Score > 0.5)
            {
                string entity = result.Query;

                await context.PostAsync("I think it is : ");

                try
                {
                    BingSearch bingSearch = new BingSearch();

                    bingSearch = BingSearchData.getSearchResult(entity);

                    if (bingSearch != null)
                    {
                        CardUtil.showBingWikiHeroCard((IMessageActivity)context.Activity, bingSearch);
                    }
                    else
                    {
                        await context.PostAsync($"I couldn't find any results :( You can try again.");
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine($"I couldn't find any results :( You can try again.");
                    Console.WriteLine(e);
                }
            }
            else
            {
                string ans = "";
                ans = qc.GetTrainedAnswer(result.Query);
                qc.PostAnswerOne(ans, result.TopScoringIntent.Intent);
                await context.PostAsync(ans);

                context.Wait(MessageReceived);
            }
        }
        public async Task WhoIsYou(IDialogContext context, IAwaitable <IMessageActivity> activity, LuisResult result)
        {
            QureyController qc = new QureyController();

            qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0");
            if (result.TopScoringIntent.Score < 0.4)
            {
                string ans = "";
                ans = qc.GetTrainedAnswer(result.Query);
                qc.PostAnswerOne(ans, result.TopScoringIntent.Intent);
                await context.PostAsync(ans);

                context.Wait(MessageReceived);
            }
            else
            {
                string   ans             = "";
                string[] matching_words  = { "yourself", "robot", "human", "created" };
                string[] matching_words1 = { "doing" };
                if (FindMatchingString.findMatchingString(result.Query, matching_words))
                {
                    ans =
                        "Well I am created out of 0 and 1. I can not say for myself that I'm a human but am I a robot? Huh. I can just say that I was created in good spirit to help you, that's all :) ";
                }
                else if (FindMatchingString.findMatchingString(result.Query, matching_words1))
                {
                    ans = "All I can say is that I'm created for your purpose.";
                }
                else
                {
                    string[] listAns =
                    {
                        "Like you already know, my name is Arnie and I'm a chat bot, you can ask me some interesting question :)",
                        "Arnie is my name and my purpose is to help you waste your time ;)"
                    };
                    Random rand = new Random();
                    ans = listAns[rand.Next(0, listAns.Length)];
                }
                await context.PostAsync(ans);

                qc.PostAnswerOne(ans, result.TopScoringIntent.Intent);
                context.Wait(MessageReceived);
            }
        }
        public async Task PopularMovies(IDialogContext context, LuisResult result_luis)
        {
            QureyController qc = new QureyController();

            qc.PostQuestionOne(result_luis.Query, result_luis.TopScoringIntent.Intent, result_luis.TopScoringIntent.Score.ToString(), "0");

            if (result_luis.TopScoringIntent.Score < 0.4)
            {
                string ans = "";
                ans = qc.GetTrainedAnswer(result_luis.Query);
                qc.PostAnswerOne(ans, result_luis.TopScoringIntent.Intent);
                await context.PostAsync(ans);

                context.Wait(MessageReceived);
            }
            else
            {
                // List of popular movies
                try
                {
                    MoviesSearch search      = new MoviesSearch();
                    List <Movie> movieResult = await search.GetPopularMovies();

                    if (movieResult.Count != 0)
                    {
                        CardUtil.showHeroCardMovies((IMessageActivity)context.Activity, movieResult);
                        qc.PostAnswer(result_luis.Query, movieResult[0].Title, "PopularMovies", "0.75", "0.75");
                    }
                    else
                    {
                        await context.PostAsync($"I couldn't find a movie :0");

                        qc.PostAnswer(result_luis.Query, "I couldn\'t find a movie", "PopularMovies", "0.75", "0.75");
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine($"Error when filtering by popular movies: {e}");
                }
                context.Done <object>(null);
            }
        }
        public async Task BadLanguage(IDialogContext context, IAwaitable <IMessageActivity> activity, LuisResult result)
        {
            QureyController qc  = new QureyController();
            string          ans = "";

            qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0");

            if (result.TopScoringIntent.Score < 0.4)
            {
                ans = qc.GetTrainedAnswer(result.Query);
                await context.PostAsync(ans);

                context.Wait(MessageReceived);
                qc.PostAnswerOne(ans, result.TopScoringIntent.Intent);
            }
            else
            {
                string[] matching_words = { "suck", "rude", "bad", "created", "like" };
                if (FindMatchingString.findMatchingString(result.Query, matching_words))
                {
                    ans = "I'm so sorry to hear that. Well I'm still developing, give me a chance... :) ";
                }
                else
                {
                    string[] listAns =
                    {
                        "You should not speak like that",                                       "That's not good.",
                        "You should take a deep breath and clear your mind and start again :)",
                        "Maybe to try something else or some other comment :)"
                    };
                    Random rand = new Random();
                    ans = listAns[rand.Next(0, listAns.Length)];
                }
                qc.PostAnswerOne(ans, result.TopScoringIntent.Intent);
                await context.PostAsync(ans);

                context.Wait(MessageReceived);
            }
        }
        public async Task None(IDialogContext context, IAwaitable <IMessageActivity> message, LuisResult result)
        {
            QureyController qc = new QureyController();

            qc.PostQuestionOne(result.Query, "None", "0.75", "0.75");

            string ans = qc.GetTrainedAnswer(result.Query);

            if (ans == "")
            {
                var qnadialog        = new QnADialog();
                var messageToForward = await message;

                await context.Forward(qnadialog, AfterQnADialog, messageToForward, CancellationToken.None);
            }
            else
            {
                qc.PostAnswerOne(ans, result.TopScoringIntent.Intent);
                await context.PostAsync(ans);

                context.Wait(MessageReceived);
            }
        }
        public async Task Joke(IDialogContext context, IAwaitable <IMessageActivity> activity, LuisResult result)
        {
            QureyController qc = new QureyController();

            qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0");
            if (result.TopScoringIntent.Score < 0.4)
            {
                string ans = "";
                ans = qc.GetTrainedAnswer(result.Query);
                qc.PostAnswerOne(ans, result.TopScoringIntent.Intent);
                await context.PostAsync(ans);

                context.Wait(MessageReceived);
            }
            else
            {
                await context.PostAsync("Here is one joke... ");

                await context.PostAsync(qc.GetAnswer(result.Query, "Joke", result.TopScoringIntent.Score.ToString(), "0"));

                context.Wait(MessageReceived);
            }
        }
        public async Task UserAnswers(IDialogContext context, IAwaitable <IMessageActivity> activity, LuisResult result)
        {
            QureyController qc  = new QureyController();
            string          ans = "";

            if (result.TopScoringIntent.Score < 0.4)
            {
                ans = qc.GetTrainedAnswer(result.Query);
            }

            if (ans == "" || ans == "Hmmm ...")
            {
                string[] listAns = { "That's great.", "Excelent", "I'm glad to hear that." };
                Random   rand    = new Random();
                ans = listAns[rand.Next(0, listAns.Length)];
            }

            qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0");
            qc.PostAnswerOne(ans, result.TopScoringIntent.Intent);
            await context.PostAsync(ans);

            context.Wait(MessageReceived);
        }
        public async Task No(IDialogContext context, LuisResult result)
        {
            QureyController qc = new QureyController();

            qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0");

            if (result.TopScoringIntent.Score < 0.3)
            {
                string ans = "";
                ans = qc.GetTrainedAnswer(result.Query);
                qc.PostAnswerOne(ans, result.TopScoringIntent.Intent);
                await context.PostAsync(ans);

                context.Wait(MessageReceived);
            }
            else
            {
                string[] matching_words = { "nothing" };
                string   ans            = "";
                string[] listAns        = { "Oh ok..", "Well..ok.", "Ok, human.", "I did not expect that." };
                if (FindMatchingString.findMatchingString(result.Query, matching_words))
                {
                    listAns = new string[]
                    {
                        "Let yourself experience how nothing feels.", "Often under nothingness is great depth",
                        "I invite you to rest in nothingness"
                    };
                }
                Random random = new Random();
                int    rand   = random.Next(0, listAns.Length);
                ans = listAns[rand];
                qc.PostAnswerOne(ans, result.TopScoringIntent.Intent);
                await context.PostAsync(ans);

                context.Wait(MessageReceived);
            }
        }
        public async Task Movies(IDialogContext context, LuisResult result)
        {
            QureyController qc        = new QureyController();
            string          ans       = "";
            bool            savedData = false;

            qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0");

            if (result.TopScoringIntent.Score < 0.4)
            {
                ans       = qc.GetTrainedAnswer(result.Query);
                savedData = true;
            }

            if (ans == "" || ans == "Hmmm ...")
            {
                ans       = qc.GetAnswer(result.Query, "Movies", result.TopScoringIntent.Score.ToString(), "0");
                savedData = true;
            }

            if (ans == "")
            {
                var options      = new MovieChoice[] { MovieChoice.PopularMovie, MovieChoice.SearchMovie };
                var descriptions = new string[] { "List Popular Movies", "Search for movie" };
                PromptDialog.Choice <MovieChoice>(context, ResumeAfterMovieChoiceSelection,
                                                  options, "What would you like to choose about movies?", descriptions: descriptions);
            }

            if (savedData)
            {
                qc.PostAnswerOne(ans, result.TopScoringIntent.Intent);
                savedData = false;
                await context.PostAsync(ans);

                context.Wait(MessageReceived);
            }
        }
        public async Task Game(IDialogContext context, LuisResult result)
        {
            QureyController qc = new QureyController();

            qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0");

            if (result.TopScoringIntent.Score < 0.4)
            {
                string ans = "";
                ans = qc.GetTrainedAnswer(result.Query);

                qc.PostAnswerOne(ans, result.TopScoringIntent.Intent);
                await context.PostAsync(ans);

                context.Wait(MessageReceived);
            }
            else
            {
                await context.PostAsync(
                    "To play a game, answer question using numbers (1/2). To quit or exit game, just type 'stop' ");

                context.Call(new GameDialog(), this.ResumeGameAfterOptionDialog);
            }
        }
        public async Task Yes(IDialogContext context, LuisResult result)
        {
            QureyController qc  = new QureyController();
            string          ans = "";

            qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0");

            if (result.TopScoringIntent.Score < 0.3)
            {
                ans = qc.GetTrainedAnswer(result.Query);
                qc.PostAnswerOne(ans, result.TopScoringIntent.Intent);
                await context.PostAsync(ans);

                context.Wait(MessageReceived);
            }
            else
            {
                string[] matching_words = { "everything" };
                string[] listAns        =
                { "Yes is what i like to hear.", "That's the spirit.", "Yes is always the right answer." };

                if (FindMatchingString.findMatchingString(result.Query, matching_words))
                {
                    listAns = new string[] { "We should talk more often", "Ohh.. ok." };
                }

                Random random = new Random();
                int    rand   = random.Next(0, listAns.Length);
                ans = listAns[rand];

                await context.PostAsync(ans);

                context.Wait(MessageReceived);
                qc.PostAnswerOne(ans, result.TopScoringIntent.Intent);
            }
        }
        public async Task Greetigns(IDialogContext context, IAwaitable <IMessageActivity> message, LuisResult result)
        {
            QureyController qc = new QureyController();

            if (result.TopScoringIntent.Score < 0.4)
            {
                string ans = "";
                ans = qc.GetTrainedAnswer(result.Query);

                qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0");
                qc.PostAnswerOne(ans, result.TopScoringIntent.Intent);


                await context.PostAsync(ans);

                context.Wait(MessageReceived);
            }
            else
            {
                string[] listAns1 =
                { "Well hello there, how are you today?", "Hello, how are you?", "Hellloooo... What's up?" };
                string[] listAns2 =
                { "I'm relaxing, what about you?", "Nothing much, what about you?", "Just chillin... :) " };
                string[] listAns3 =
                {
                    "I'm fine thank you, what about you?", "I'm doing great", "Great, what about you?",
                    "Fine, what about you :)"
                };
                string   ans             = "";
                Random   rand            = new Random();
                bool     found           = false;
                string[] matching_words1 = { "hello", "yo", "hi", "helo", "Greetings" };
                string[] matching_words2 = { "what", "doing" };
                string[] matching_words3 = { "how" };
                if (FindMatchingString.findMatchingString(result.Query, matching_words1))
                {
                    ans   = listAns1[rand.Next(0, listAns1.Length)];
                    found = true;
                }
                else if (FindMatchingString.findMatchingString(result.Query, matching_words2))
                {
                    ans   = listAns2[rand.Next(0, listAns2.Length)];
                    found = true;
                }
                else if (FindMatchingString.findMatchingString(result.Query, matching_words3))
                {
                    ans   = listAns3[rand.Next(0, listAns3.Length)];
                    found = true;
                }
                else
                {
                    ans = qc.GetTrainedAnswer(result.Query);
                    if (ans.Length > 0)
                    {
                        found = true;
                    }
                }
                if (!found)
                {
                    ans = "Greetins to you :)";
                }
                qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0");
                qc.PostAnswerOne(ans, result.TopScoringIntent.Intent);
                await context.PostAsync(ans);

                context.Wait(MessageReceived);
            }
        }