public static int XQ_Event(string robotQQ, int eventType, int extraType, string from, string fromQQ, string targetQQ, string content, string index, string msgid, string udpmsg, string unix, int p) { try { if (eventType == (int)XQEventType.Group) { if (Event_GroupMsgHandler != null)//群聊消息 { XQAppGroupMsgEventArgs args = new XQAppGroupMsgEventArgs(robotQQ, (int)eventType, (int)extraType, from, fromQQ, content, index, msgid, xqapi); Event_GroupMsgHandler(typeof(XQEvent), args); return(args.Handler ? 2 : 1); //阻塞返回2,继续返回1 } } if (eventType == (int)XQEventType.Friend)//好友消息 { if (Event_PrivateMsgHandler != null) { XQAppPrivateMsgEventArgs args = new XQAppPrivateMsgEventArgs(robotQQ, (int)eventType, (int)extraType, from, content, index, msgid, xqapi); Event_PrivateMsgHandler(typeof(XQEvent), args); return(args.Handler ? 2 : 1); //阻塞返回2,继续返回1 } } if (eventType == (int)XQEventType.PluginEnable)//插件启动 { if (Event_AppEnableHandler != null) { var args = new XQEventArgs(xqapi); Event_AppEnableHandler(typeof(XQEvent), args); } } if (eventType == (int)XQEventType.AddGroup || eventType == (int)XQEventType.InvitedToGroup)//群申请/邀请事件AddGroup { if (Event_AddGroupHandler != null) { var args = new XQAddGroupEventArgs(xqapi, robotQQ, eventType, fromQQ, from, udpmsg); Event_AddGroupHandler(typeof(XQEvent), args); } } if (eventType == (int)XQEventType.AddFriend)//加好友事件 { if (Event_AddFriendHandler != null) { var args = new XQAddFriendEventArgs(xqapi, robotQQ, eventType, fromQQ); Event_AddFriendHandler(typeof(XQEvent), args); } } if (eventType == (int)XQEventType.BanSpeak)//被禁言 { if (Event_BanSpeak != null) { var args = new XQBanSpeakEventArgs(xqapi, robotQQ, eventType, fromQQ, targetQQ, from); Event_BanSpeak(typeof(XQEvent), args); } } if (eventType == (int)XQEventType.AddFriend)//被解除禁言 { if (Event_UnBanSpeak != null) { var args = new XQUnBanSpeakEventArgs(xqapi, robotQQ, eventType, fromQQ, targetQQ, from); Event_UnBanSpeak(typeof(XQEvent), args); } } return(1); } catch (Exception ex) { xqapi.Error(ex.Message); return(1); } }
public static int Event(string robotQQ, int eventType, int extraType, string from, string fromQQ, string targetQQ, string content, string index, string msgid, string udpmsg, string unix, int p) { try { if (eventType == (int)XQEventType.Group) { if (Event_GroupMsgHandler != null)//群聊消息 { XQAppGroupMsgEventArgs args = new XQAppGroupMsgEventArgs(robotQQ, (int)eventType, (int)extraType, from, fromQQ, content, index, msgid, Common.xQAPI); Event_GroupMsgHandler(typeof(_Event), args); return(args.Handler ? 2 : 1); //阻塞返回2,继续返回1 } } if (eventType == (int)XQEventType.Friend)//好友消息 { if (Event_PrivateMsgHandler != null) { XQAppPrivateMsgEventArgs args = new XQAppPrivateMsgEventArgs(robotQQ, (int)eventType, (int)extraType, from, content, index, msgid, Common.xQAPI); Event_PrivateMsgHandler(typeof(_Event), args); return(args.Handler ? 2 : 1); //阻塞返回2,继续返回1 } } if (eventType == (int)XQEventType.GroupTmp)//群临时消息 { if (Event_PrivateMsgHandler != null) { XQAppPrivateMsgEventArgs args = new XQAppPrivateMsgEventArgs(robotQQ, (int)eventType, (int)extraType, fromQQ, content, index, msgid, Common.xQAPI); args.FromGroup = new XQ.Net.SDK.Models.XQGroup(from, Common.xQAPI); Event_PrivateMsgHandler(typeof(_Event), args); return(args.Handler ? 2 : 1); //阻塞返回2,继续返回1 } } if (eventType == (int)XQEventType.PluginEnable)//插件启动 { if (Event_AppEnableHandler != null) { var args = new XQEventArgs(Common.xQAPI); Event_AppEnableHandler(typeof(_Event), args); } } if (eventType == (int)XQEventType.AddGroup || eventType == (int)XQEventType.InvitedToGroup || eventType == (int)XQEventType.SomeoneInvitedToGroup || eventType == (int)XQEventType.AllowedToGroup) //群申请/邀请事件AddGroup { if (Event_AddGroupHandler != null) { var args = new XQAddGroupEventArgs(Common.xQAPI, robotQQ, eventType, fromQQ, from, udpmsg); Event_AddGroupHandler(typeof(_Event), args); } } if (eventType == (int)XQEventType.AddFriend)//加好友事件 { if (Event_AddFriendHandler != null) { var args = new XQAddFriendEventArgs(Common.xQAPI, robotQQ, eventType, fromQQ); Event_AddFriendHandler(typeof(_Event), args); } } if (eventType == (int)XQEventType.BanSpeak)//被禁言 { if (Event_BanSpeak != null) { var args = new XQBanSpeakEventArgs(Common.xQAPI, robotQQ, eventType, fromQQ, targetQQ, from); Event_BanSpeak(typeof(_Event), args); } } if (eventType == (int)XQEventType.UnBanSpeak)//被解除禁言 { if (Event_UnBanSpeak != null) { var args = new XQUnBanSpeakEventArgs(Common.xQAPI, robotQQ, eventType, fromQQ, targetQQ, from); Event_UnBanSpeak(typeof(_Event), args); } } return(1); } catch (Exception ex) { Common.Log(ex.ToString()); return(1); } }