Example #1
0
        public static void Init()
        {
            CosturaUtility.Initialize();

            XQMain.Register(unityContainer);

            XQApi.Api_OutPutLog($"依赖注入{unityContainer.Registrations.Count()}");

            XQEvent.Event_GroupMsgHandler += unityContainer.Resolve <IXQGroupMessage>().GroupMessage;
        }
Example #2
0
        public static int XQ_Event(string robotQQ, int EventType, int ExtraType, string From, string FromQQ, string targetQQ, string content, string index, string id, string udpmsg, string unix, int p)
        {
            XQApi.Api_OutPutLog($"来自:{From}的消息,Type{EventType}被我捉到啦!");
            if (EventType == (int)XQEventType.Group)
            {
                if (Event_GroupMsgHandler != null)
                {
                    XQAppGroupMsgEventArgs args = new XQAppGroupMsgEventArgs(robotQQ, (int)EventType, (int)ExtraType, From, content);
                    Event_GroupMsgHandler(typeof(XQEvent), args);
                }


                if (From == "894727248")
                {
                    if (content == "测试XQ框架")
                    {
                        //XQApi.Api_OutPutLog($"恶臭测试");
                        XQApi.Native_SendGroupMsg(robotQQ, From, "恶臭测试-Native.XQ.Net");
                    }
                    if (content.StartsWith("复读机"))
                    {
                        XQApi.Native_SendGroupMsg(robotQQ, From, $"{content.Substring(3).Trim()}\n-Native.XQ.Net");
                    }
                }
            }
            if (EventType == (int)XQEventType.Friend)
            {
                XQApi.Api_OutPutLog($"h测试的状态{XQApi.Api_IsEnable()}");
                var botqq  = Marshal.StringToHGlobalAnsi(robotQQ);
                var group  = Marshal.StringToHGlobalAnsi(From);
                var target = Marshal.StringToHGlobalAnsi(FromQQ);
                var msg    = Marshal.StringToHGlobalAnsi("恶臭测试-Native.XQ.Net");

                XQApi.Api_SendMsgIntPtr(botqq, 1, group, target, msg, 0);

                //XQApi.Api_SendMsg(Marshal.PtrToStringAnsi(robotQQ), EventType,"",Marshal.PtrToStringAnsi(From),Marshal.StringToHGlobalAnsi(strMsg), 0);
            }
            return(1);
        }
Example #3
0
 /// <summary>
 /// 发送群消息
 /// </summary>
 /// <param name="robotQQ"></param>
 /// <param name="msg"></param>
 public void SendMessage(string robotQQ, string msg)
 {
     XQApi.Native_SendGroupMsg(robotQQ, GroupId, msg);
 }