Answer() public method

向机器人说话,返回机器人的回复。
public Answer ( string message, System options ) : string
message string 向机器人说话的内容
options System 存储了说话时的其它附属信息。 /// /// speaker: 问话的人的名字。 /// speakerID: 问话的人的 ID。 /// group: 所在的群。 /// groupID: 所在的群的 ID。 /// time: 提问的时间。 /// ///
return string
Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.Title = "AI-Robot 自动聊天机器人";
            Console.WriteLine("输入任何文字并回车...");

            // 创建一个简单的机器人并回复。
            IRobot robot = new SimpleRobot();
            string s;

            while ((s = Console.ReadLine()) != null) {
                string answer = robot.Answer(s, new NameValueCollection());

                if (answer == null) {
                    Console.WriteLine("(无法回复)");
                } else {
                    Console.WriteLine(answer);
                }

            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.Title = "AI-Robot 自动聊天机器人";
            Console.WriteLine("输入任何文字并回车...");

            // 创建一个简单的机器人并回复。
            IRobot robot = new SimpleRobot();
            string s;

            while ((s = Console.ReadLine()) != null)
            {
                string answer = robot.Answer(s, new NameValueCollection());

                if (answer == null)
                {
                    Console.WriteLine("(无法回复)");
                }
                else
                {
                    Console.WriteLine(answer);
                }
            }
        }