Example #1
0
        private void Meow_OnEventMsgs(object sender, ObjectEvent.ObjectEventArgs e)
        {
            var d = new Event(e.Data);

            switch (d.EType.ToString())
            {
            case "ON_EVENT_GROUP_ADMIN":
            {
                var x = (ON_EVENT_GROUP_ADMIN)d.Data;
                __ON_EVENT_GROUP_ADMIN.Invoke(d.EMsg, x);
                ServerUtil.Log($"[*群管理员变更*] 群{x.GroupID}的{x.UserID}{(x.Flag == 0 ? "不再是管理员了" : "成为管理员")}", LogType.ClientVerbose);
            }
            break;

            case "ON_EVENT_GROUP_SHUT":
            {
                var x = (ON_EVENT_GROUP_SHUT)d.Data;
                __ON_EVENT_GROUP_SHUT.Invoke(d.EMsg, x);
                ServerUtil.Log($"[*群禁言*] 群{x.GroupID}的{(x.UserID == 0 ? "全体" : x.UserID)}被{(x.ShutTime == 0 ? "解除禁言" : $"禁言{x.ShutTime}分钟")}", LogType.ClientVerbose);
            }
            break;
Example #2
0
        private void Meow_OnFriendMsgs(object sender, ObjectEvent.ObjectEventArgs e)
        {
            #region 私聊报头 -- Private Info Head --
            var prop = new QQRecieveMessage(
                MessageIOType.Friend,
                new IOBody(
                    e.Data["FromUin"].ToObject <long>(),
                    e.Data["ToUin"].ToObject <long>(),
                    null,
                    null,
                    null
                    ),
                new MsgProperty(
                    null,
                    e.Data["MsgSeq"].ToObject <long?>(),
                    null,
                    null,
                    e.Data["RedBaginfo"].ToString(),
                    null
                    ),
                e.CurrentQQ
                );
            #endregion
            //文本
            var content = e.Data["Content"].ToString();
            //触发对应操作信息
            switch (e.Data["MsgType"].ToString())
            {
            case "TextMsg":
            {
                var msg = new TextMsg(content);
                _FriendTextMsgRecieve.Invoke(prop, msg);
                ServerUtil.Log($"好友文本信息 [{prop.IOBody.MsgFromQQ}->{prop.IOBody.MsgRecvQQ}] \n" +
                               $"内容:{msg.Content}", LogType.ClientMessage, ConsoleColor.Magenta);
            }
            break;

            case "PicMsg":
            {
                var msg = new PicMsg(content);
                _FriendPicMsgRecieve.Invoke(prop, msg);
                if (msg._isSnapPic)
                {
                    ServerUtil.Log($"好友闪照信息 [{prop.IOBody.MsgFromQQ}->{prop.IOBody.MsgRecvQQ}]", LogType.ClientMessage, ConsoleColor.Yellow);
                }
                else
                {
                    ServerUtil.Log($"好友图片信息 [{prop.IOBody.MsgFromQQ}->{prop.IOBody.MsgRecvQQ}] \n" +
                                   $"内容:{msg.Content} | 图片共 {msg.PicList.Length} 张", LogType.ClientMessage, ConsoleColor.Yellow);
                }
            }
            break;

            case "VoiceMsg":
            {
                var msg = new VoiceMsg(content);
                _FriendVocMsgRecieve.Invoke(prop, msg);
                ServerUtil.Log($"好友语音信息 [{prop.IOBody.MsgFromQQ}->{prop.IOBody.MsgRecvQQ}]"
                               , LogType.ClientMessage, ConsoleColor.DarkMagenta);
            }
            break;

            case "VideoMsg":
            {
                var msg = new VideoMsg(content);
                _FriendVidMsgRecieve.Invoke(prop, msg);
                ServerUtil.Log($"好友视频信息 [{prop.IOBody.MsgFromQQ}->{prop.IOBody.MsgRecvQQ}]"
                               , LogType.ClientMessage, ConsoleColor.Green);
            }
            break;
            }
            ;
        }
Example #3
0
        private void Meow_OnGroupMsgs(object sender, ObjectEvent.ObjectEventArgs e)
        {
            #region 群聊报头 -- Group Info Head --
            var prop = new QQRecieveMessage(
                MessageIOType.Friend,
                new IOBody(
                    e.Data["FromUserId"].ToObject <long>(),
                    0,
                    e.Data["FromNickName"].ToString(),
                    e.Data["FromGroupId"].ToObject <long>(),
                    e.Data["FromGroupName"].ToString()
                    ),
                new MsgProperty(
                    null,
                    e.Data["MsgSeq"].ToObject <long?>(),
                    e.Data["MsgRandom"].ToObject <long?>(),
                    null,
                    e.Data["RedBaginfo"].ToString(),
                    e.Data["MsgTime"].ToObject <long?>()
                    ),
                e.CurrentQQ
                );
            #endregion
            //文本
            var content = e.Data["Content"].ToString();
            //触发对应操作信息
            switch (e.Data["MsgType"].ToString())
            {
            case "TextMsg":
            {
                var msg = new TextMsg(content);
                _GroupTextMsgRecieve.Invoke(prop, msg);
                ServerUtil.Log($"群文本信息 [{prop.IOBody.MsgFromQQ}] " +
                               $"在群聊 [{prop.IOBody.FromGroupId} :: {prop.IOBody.FromGroupName}] \n" +
                               $"内容:{msg.Content}", LogType.ClientMessage, ConsoleColor.Magenta);
            }
            break;

            case "AtMsg":
            {
                var msg = new AtTextMsg(content);
                _GroupAtTextMsgRecieve.Invoke(prop, msg);
                ServerUtil.Log($"群At文本信息 [{prop.IOBody.MsgFromQQ}] " +
                               $"在群聊 [{prop.IOBody.FromGroupId} :: {prop.IOBody.FromGroupName}] \n" +
                               $"内容:{msg.Content}", LogType.ClientMessage, ConsoleColor.Magenta, ConsoleColor.Cyan);
            }
            break;

            case "PicMsg":
            {
                var msg = new PicMsg(content);
                var d   = "图片";
                if (msg.AtedQQ != null)
                {
                    _GroupAtPicMsgRecieve.Invoke(prop, msg);
                    d = "At图片";
                }
                if (msg._isSnapPic)
                {
                    d = "闪照";
                }
                _GroupPicMsgRecieve.Invoke(prop, msg);
                ServerUtil.Log($"群{d} [{prop.IOBody.MsgFromQQ}] " +
                               $"在群聊 [{prop.IOBody.FromGroupId} :: {prop.IOBody.FromGroupName}] \n" +
                               $"内容:{msg.Content} | 图片共 {msg.PicList.Length} 张", LogType.ClientMessage, ConsoleColor.Yellow);
            }
            break;

            case "VoiceMsg":
            {
                var msg = new VoiceMsg(content);
                _GroupVocMsgRecieve.Invoke(prop, msg);
                ServerUtil.Log($"群语音信息 [{prop.IOBody.MsgFromQQ}] " +
                               $"在群聊 [{prop.IOBody.FromGroupId} :: {prop.IOBody.FromGroupName}]"
                               , LogType.ClientMessage, ConsoleColor.DarkMagenta);
            }
            break;

            case "VideoMsg":
            {
                var msg = new VideoMsg(content);
                _GroupVidMsgRecieve.Invoke(prop, msg);
                ServerUtil.Log($"群视频信息 [{prop.IOBody.MsgFromQQ}] " +
                               $"在群聊 [{prop.IOBody.FromGroupId} :: {prop.IOBody.FromGroupName}]"
                               , LogType.ClientMessage, ConsoleColor.Green);
            }
            break;
            }
            ;
        }