Ejemplo n.º 1
0
        public async Task <string> GenerateMessage(int wordLimit = 50) =>
        await Task.Run(() => {
            if (MarkovData[MarkovData.start].Count == 0)
            {
                return("Markov Chain database is empty, Try saying some things!");
            }

            StringBuilder builder = new StringBuilder();
            string lastWord       = MarkovData.start;
            for (int i = 0; (builder.Length < MaxGenLength) || (i > wordLimit); i++)
            {
                List <string> words = MarkovData[lastWord];
                if (words.Count == 0)
                {
                    i--;
                    continue;                             // This should never happen
                }

                lastWord = words[LilGUtil.RandInt(0, words.Count - 1)];
                if (lastWord == MarkovData.end)
                {
                    break;
                }

                builder.Append(lastWord).Append(" ");
            }

            return(builder.ToString());
        });
Ejemplo n.º 2
0
        public async Task HandleCommand(IListener listener, IRespondable respondTo, IList <string> args, LinkedMessage e)
        {
            int    choice   = LilGUtil.RandInt(1, 20);
            string response = "";

            switch (choice)
            {
            case 1:
                response = "It is certain";
                break;

            case 2:
                response = "It is decidedly so";
                break;

            case 3:
                response = "Without a doubt";
                break;

            case 4:
                response = "Yes - definitely";
                break;

            case 5:
                response = "You may rely on it";
                break;

            case 6:
                response = "As I see it, yes";
                break;

            case 7:
                response = "Most likely";
                break;

            case 8:
                response = "Outlook good";
                break;

            case 9:
                response = "Signs point to yes";
                break;

            case 10:
                response = "Yes";
                break;

            case 11:
                response = "Reply hazy, try again";
                break;

            case 12:
                response = "Ask again later";
                break;

            case 13:
                response = "Better not tell you now";
                break;

            case 14:
                response = "Cannot predict now";
                break;

            case 15:
                response = "Concentrate and ask again";
                break;

            case 16:
                response = "Don't count on it";
                break;

            case 17:
                response = "My reply is no";
                break;

            case 18:
                response = "My sources say no";
                break;

            case 19:
                response = "Outlook not so good";
                break;

            case 20:
                response = "Very doubtful";
                break;
            }

            await respondTo.respond(response, e.author);
        }