コード例 #1
0
        private static string GetMarkovResponse(string[] lines)
        {
            Dictionary <string, List <string> > wordDictionary = CreateWordDictionary(lines);
            string startWord = Rng.PickRandom(wordDictionary.Keys.ToArray());

            return(GenerateMarkov(wordDictionary, startWord));
        }
コード例 #2
0
        public static Response Predict(Request request)
        {
            if (request.CommandArgs.Length == 0)
            {
                return(new Response("You didn't ask a question."));
            }

            string[] predictions = new string[]
            {
                "It is certain.",
                "It is decidedly so.",
                "Without a doubt.",
                "Yes, definitely.",
                "You may rely on it.",
                "As I see it, yes.",
                "Most likely.",
                "Outlook good.",
                "Yes.",
                "Signs point to yes.",
                "Reply hazy, try again.",
                "Ask again later.",
                "Better not tell you now.",
                "Cannot predict now.",
                "Concentrate and ask again.",
                "Don't count on it.",
                "My reply is no.",
                "My sources say no.",
                "Outlook not so good.",
                "Very doubtful."
            };

            string result = Rng.PickRandom(predictions);

            return(new Response(result));
        }
コード例 #3
0
        public static Response PickOne(Request request)
        {
            if (request.CommandArgs.Length < 2)
            {
                return(new Response("Usage: !pick option1, option2, [option3, ...]"));
            }

            string[] commaSplitArgs = string.Join(" ", request.CommandArgs).Split(", ");

            string result = Rng.PickRandom(commaSplitArgs);

            return(new Response(result));
        }
コード例 #4
0
ファイル: General.cs プロジェクト: rekyuu/KumaKaiNi.Net
        public static Response Hello()
        {
            string reply = Rng.PickRandom(new[] { "sup", "yo", "ay", "hi", "wassup" });

            if (Rng.OneTo(25))
            {
                return(new Response(reply));
            }
            else
            {
                return(new Response());
            }
        }
コード例 #5
0
ファイル: Images.cs プロジェクト: rekyuu/KumaKaiNi.Net
        public static Response Smug()
        {
            using HttpClient client = new HttpClient();
            client.DefaultRequestHeaders.Add("Authorization", $"Client-ID {Config.ImgurClientId}");
            HttpResponseMessage request  = client.GetAsync("https://api.imgur.com/3/album/zSNC1").Result;
            ImgurResults        response = JsonConvert.DeserializeObject <ImgurResults>(request.Content.ReadAsStringAsync().Result);
            ImgurImage          result   = Rng.PickRandom(response?.Data.Images);

            ResponseImage image = new ResponseImage()
            {
                Url         = result.Link.ToString(),
                Source      = $"https://imgur.com/{result.Id}",
                Description = "",
                Referrer    = "imgur.com"
            };

            return(new Response(image));
        }
コード例 #6
0
        public static Response CoinFlip()
        {
            string result = Rng.PickRandom(new[] { "Heads.", "Tails." });

            return(new Response(result));
        }
コード例 #7
0
ファイル: General.cs プロジェクト: rekyuu/KumaKaiNi.Net
        public static Response Thanks()
        {
            string reply = Rng.PickRandom(new[] { "np", "don't mention it", "anytime", "sure thing", "ye whateva" });

            return(new Response(reply));
        }
コード例 #8
0
ファイル: General.cs プロジェクト: rekyuu/KumaKaiNi.Net
        public static Response Kuma()
        {
            string reply = Rng.PickRandom(new[] { "Kuma?", "Kuma~!", "Kuma...", "Kuma!!", "Kuma.", "Kuma...?" });

            return(new Response(reply));
        }