Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="type">21/好友 2/群 4/讨论组</param>
        /// <param name="subType"></param>
        /// <param name="sendTime"></param>
        /// <param name="fromQQ"></param>
        /// <param name="msg"></param>
        /// <param name="font"></param>
        public void OnMessage(int type, int subType, int sendTime, long groupID, long fromQQ, string msg, int font)
        {
            // 处理私聊消息。
            // CQX.SendPrivateMessage(fromQQ, String.Format("[{0}]你发的私聊消息是:{1}", CQX.ProxyType, msg));
            // var img = CQX.CQCode_Image(@"C:\Users\Yin\Desktop\图\2015-12-25\修改体验\hint_get_diamond_big.png");
            // CQX.SendPrivateMessage(fromQQ, img);
            // https://download.csdn.net/download/s15100007883/10406823
            var head = "https://download.csdn.net/download/";

            if (msg.Contains("重启") && msg.Contains("鸭"))
            {
                PipeMsg _msg = new PipeMsg();
                _msg.fromGroup  = groupID;
                _msg.fromUrl    = "重启鸭子";
                _msg.fromQQType = type;
                _msg.fromQQ     = fromQQ;
                var _sMsg = JsonConvert.SerializeObject(_msg);
                pipeclient.Send(_sMsg);
                CQX.SendMessage(_msg.fromQQType, _msg.fromGroup, _msg.fromQQ, "满血复活~");
                return;
            }

            if (!msg.Contains(head))
            {
                return;
            }

            var sub = msg.GetAfter(head);
            var st  = sub.IndexOf("/");
            var end = sub.Length;

            if (st < 0)
            {
                return;
            }

            for (int i = 0; i < 12 && i + st + 1 < sub.Length; i++)
            {
                var num = sub[i + st + 1];
                if (num < '0' || num > '9')
                {
                    end = i + st + 1;
                    break;
                }
            }

            var     url  = head + sub.Substring(0, end);
            PipeMsg pMsg = new PipeMsg();

            pMsg.fromGroup  = groupID;
            pMsg.fromUrl    = url;
            pMsg.fromQQType = type;
            pMsg.fromQQ     = fromQQ;
            var s_pMsg = JsonConvert.SerializeObject(pMsg);

            pipeclient.Send(s_pMsg);
        }
Пример #2
0
 private void UpdateSendMsg()
 {
     if (Time.current - m_lastSend > MIN_SEND_INTERVAL && msgQueue.Count > 0)
     {
         Msg msg = msgQueue.Dequeue();
         // msg.msg = rand.Next(100, 999) + "\n" + msg.msg;
         CQX.SendPrivateMessage(long.Parse(msg.playerID), msg.msg);
         m_lastSend = Time.current + rand.Next(0, 3) * MIN_SEND_INTERVAL * 0.1f;
     }
 }
Пример #3
0
        public string GetName(string playerID)
        {
            string name = "";

            if (!m_nameCached.TryGetValue(playerID, out name))
            {
                name = CQX.GetQQName(long.Parse(playerID));
                m_nameCached.Add(playerID, name);
            }
            return("【{0}】".FormatStr(name));
        }
Пример #4
0
        private void Pipechanel_msgReceived(object sender, PipeChanel.PipeMsg.PipeMsgEventArgs e)
        {
            PipeMsg msg = JsonConvert.DeserializeObject <PipeMsg>(e.receivedMsg);
            string  str = "";

            if (msg.isDownloadSuccess)
            {
                str += "下载成功: " + msg.downloadFileName;
                str += "\n" + msg.downloadUrl;
            }
            else
            {
                str += msg.dowloadErrorInfo;
            }
            CQX.SendMessage(msg.fromQQType, msg.fromGroup, msg.fromQQ, str);
        }