private static int EventRequestAddGroup(int subType, int sendTime, long fromGroup, long fromQQ, IntPtr msg, string responseFlag) { GroupAddRequestEventArgs args = new GroupAddRequestEventArgs(); args.SendTime = NativeConvert.FotmatUnixTime(sendTime.ToString()); args.FromGroup = fromGroup; args.FromQQ = fromQQ; args.AppendMsg = NativeConvert.ToPtrString(msg, Encoding.GetEncoding("GB18030")); args.Tag = responseFlag; args.Handled = false; if (subType == 1) // 申请加入群 { ReceiveGroupAddApply(null, args); } else if (subType == 2) // 机器人被邀请 { ReceiveGroupAddInvitee(null, args); } else { Common.CqApi.AddLoger(LogerLevel.Info, "Native提示", "EventRequestAddGroup 方法发现新的消息类型"); } return(0); }
private static int EventGroupMsg(int subType, int msgId, long fromGroup, long fromQQ, string fromAnonymous, IntPtr msg, int font) { GroupMessageEventArgs args = new GroupMessageEventArgs(); args.MsgId = msgId; args.FromGroup = fromGroup; args.FromQQ = fromQQ; args.Msg = NativeConvert.ToPtrString(msg, Encoding.GetEncoding("GB18030")); args.FromAnonymous = null; args.IsAnonymousMsg = false; args.Handled = false; if (fromQQ == 80000000 && !string.IsNullOrEmpty(fromAnonymous)) { args.FromAnonymous = Common.CqApi.GetAnonymous(fromAnonymous); //获取匿名成员信息 args.IsAnonymousMsg = true; } if (subType == 1) // 群消息 { ReceiveGroupMessage(null, args); } else // 其它类型 { Common.CqApi.AddLoger(LogerLevel.Info, "Native提示", "EventGroupMsg 方法发现新的消息类型"); } return((int)(args.Handled ? MessageHanding.Intercept : MessageHanding.Ignored)); //如果处理过就截断消息 }
private static int EventPrivateMsg(int subType, int msgId, long fromQQ, IntPtr msg, int font) { PrivateMessageEventArgs args = new PrivateMessageEventArgs(); args.MsgId = msgId; args.FromQQ = fromQQ; args.Msg = NativeConvert.ToPtrString(msg, Encoding.GetEncoding("GB18030")); args.Handled = false; if (subType == 11) // 来自好友 { ReceiveFriendMessage(null, args); } else if (subType == 1) // 来自在线状态 { ReceiveQnlineStatusMessage(null, args); } else if (subType == 2) // 来自群 { ReceiveGroupPrivateMessage(null, args); } else if (subType == 3) // 来自讨论组 { ReceiveDiscussPrivateMessage(null, args); } else { Common.CqApi.AddLoger(LogerLevel.Info, "Native提示", "EventPrivateMsg 方法发现新的消息类型"); } return((int)(args.Handled ? MessageHanding.Intercept : MessageHanding.Ignored)); //如果处理过就截断消息 }
private static int EventRequestAddFriend(int subType, int sendTime, long fromQQ, IntPtr msg, string responseFlag) { FriendAddRequestEventArgs args = new FriendAddRequestEventArgs(); args.SendTime = NativeConvert.FotmatUnixTime(sendTime.ToString()); args.FromQQ = fromQQ; args.AppendMsg = NativeConvert.ToPtrString(msg, Encoding.GetEncoding("GB18030")); args.Tag = responseFlag; args.Handled = false; if (subType == 1) // 好友添加请求 { ReceiveFriendAdd(null, args); } else { Common.CqApi.AddLoger(LogerLevel.Info, "Native提示", "EventRequestAddFriend 方法发现新的消息类型"); } return((int)(args.Handled ? MessageHanding.Intercept : MessageHanding.Ignored)); //如果处理过就截断消息 }
private static int EventDiscussMsg(int subType, int msgId, long fromDiscuss, long fromQQ, IntPtr msg, int font) { DiscussMessageEventArgs args = new DiscussMessageEventArgs(); args.MsgId = msgId; args.FromDiscuss = fromDiscuss; args.FromQQ = fromQQ; args.Msg = NativeConvert.ToPtrString(msg, Encoding.GetEncoding("GB18030")); args.Handled = false; if (subType == 1) // 讨论组消息 { ReceiveDiscussMessage(null, args); } else { Common.CqApi.AddLoger(LogerLevel.Info, "Native提示", "EventDiscussMsg 方法发现新的消息类型"); } return((int)(args.Handled ? MessageHanding.Intercept : MessageHanding.Ignored)); //如果处理过就截断消息 }
/// <summary> /// 获取当前登录QQ的昵称 /// </summary> /// <returns></returns> public string GetLoginNick() { return(NativeConvert.ToPtrString(CQP.CQ_getLoginNick(_authCode))); }