예제 #1
0
        void cw_RevMsg(string msg)
        {
            JsonChatMessage ChatMessage = new JsonChatMessage(msg);

            try
            {
                for (int i = 0; i <= ChatMessage.Result.GetUpperBound(0); i++)
                {
                    string poll_type = ChatMessage.Result[0].PollType;
                    if (poll_type == "message")                                          //如果是QQ消息
                    {
                        string FromUin = ChatMessage.Result[i].Value.FromUin.ToString(); //消息发送者
                        string Content = ChatMessage.Result[i].Value.Content.Text;       //QQ消息

                        Console.WriteLine(Content);
                    }
                    else if (poll_type == "group_message")//如果是群消息
                    {
                        string Content = ChatMessage.Result[i].Value.Content.Text;
                        string SendUin = ChatMessage.Result[i].Value.SendUin.ToString();
                        string Gid     = ChatMessage.Result[i].Value.FromUin.ToString();
                        string Code    = ChatMessage.Result[i].Value.GroupCode.ToString();

                        Console.WriteLine(Content);
                    }
                    else if (poll_type == "sys_g_msg" || poll_type == "system_message")//如果是系统消息
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
예제 #2
0
        void cw_RevMsg(string msg)
        {
            JsonChatMessage ChatMessage = new JsonChatMessage(msg);
            try
            {
                for (int i = 0; i <= ChatMessage.Result.GetUpperBound(0); i++)
                {
                    string poll_type = ChatMessage.Result[0].PollType;
                    if (poll_type == "message")//如果是QQ消息
                    {
                        string FromUin = ChatMessage.Result[i].Value.FromUin.ToString();//消息发送者
                        string Content = ChatMessage.Result[i].Value.Content.Text;//QQ消息

                        Console.WriteLine(Content);
                    }
                    else if (poll_type == "group_message")//如果是群消息
                    {
                        string Content = ChatMessage.Result[i].Value.Content.Text;
                        string SendUin = ChatMessage.Result[i].Value.SendUin.ToString();
                        string Gid = ChatMessage.Result[i].Value.FromUin.ToString();
                        string Code = ChatMessage.Result[i].Value.GroupCode.ToString();

                        Console.WriteLine(Content);
                    }
                    else if (poll_type == "sys_g_msg" || poll_type == "system_message")//如果是系统消息
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }