diff --git a/Lagrange.Core/Internal/Packets/Message/Notify/GroupChange.cs b/Lagrange.Core/Internal/Packets/Message/Notify/GroupChange.cs index bcb9fe19b..100b4a3f2 100644 --- a/Lagrange.Core/Internal/Packets/Message/Notify/GroupChange.cs +++ b/Lagrange.Core/Internal/Packets/Message/Notify/GroupChange.cs @@ -8,16 +8,36 @@ namespace Lagrange.Core.Internal.Packets.Message.Notify; internal class GroupChange { [ProtoMember(1)] public uint GroupUin { get; set; } - + [ProtoMember(2)] public uint Flag { get; set; } - + [ProtoMember(3)] public string MemberUid { get; set; } - + [ProtoMember(4)] public uint DecreaseType { get; set; } // 131 Kick 130 Exit - - [ProtoMember(5)] public string? OperatorUid { get; set; } - + + [ProtoMember(5)] public byte[]? Operator { get; set; } + [ProtoMember(6)] public uint IncreaseType { get; set; } - + [ProtoMember(7)] public byte[]? Field7 { get; set; } +} + +[ProtoContract] +internal class OperatorInfo +{ + [ProtoMember(1)] public OperatorField1 Operator { get; set; } +} + +[ProtoContract] +internal class OperatorField1 +{ + [ProtoMember(1)] public string? Uid { get; set; } + + [ProtoMember(2)] public uint Field2 { get; set; } + + [ProtoMember(3)] public byte[]? Field3 { get; set; } + + [ProtoMember(4)] public uint Field4 { get; set; } + + [ProtoMember(5)] public byte[]? Field5 { get; set; } } \ No newline at end of file diff --git a/Lagrange.Core/Internal/Service/Message/PushMessageService.cs b/Lagrange.Core/Internal/Service/Message/PushMessageService.cs index 04c1406aa..018ec2d39 100644 --- a/Lagrange.Core/Internal/Service/Message/PushMessageService.cs +++ b/Lagrange.Core/Internal/Service/Message/PushMessageService.cs @@ -1,3 +1,4 @@ +using System.Text; using Lagrange.Core.Common; using Lagrange.Core.Internal.Event; using Lagrange.Core.Internal.Event.Message; @@ -88,14 +89,23 @@ protected override bool Parse(Span input, BotKeystore keystore, BotAppInfo case PkgType.GroupMemberIncreaseNotice when message.Message.Body?.MsgContent is { } content: { var increase = Serializer.Deserialize(content.AsSpan()); - var increaseEvent = GroupSysIncreaseEvent.Result(increase.GroupUin, increase.MemberUid, increase.OperatorUid, increase.DecreaseType); + var increaseEvent = GroupSysIncreaseEvent.Result(increase.GroupUin, increase.MemberUid, Encoding.UTF8.GetString(increase.Operator.AsSpan()), increase.DecreaseType); extraEvents.Add(increaseEvent); break; } case PkgType.GroupMemberDecreaseNotice when message.Message.Body?.MsgContent is { } content: { var decrease = Serializer.Deserialize(content.AsSpan()); - var decreaseEvent = GroupSysDecreaseEvent.Result(decrease.GroupUin, decrease.MemberUid, decrease.OperatorUid, decrease.DecreaseType); + GroupSysDecreaseEvent decreaseEvent; + if (decrease.DecreaseType == 3) // 3 是bot自身被踢出,Operator字段会是一个protobuf + { + var op = Serializer.Deserialize(decrease.Operator.AsSpan()); + decreaseEvent = GroupSysDecreaseEvent.Result(decrease.GroupUin, decrease.MemberUid, op.Operator.Uid, decrease.DecreaseType); + } + else + { + decreaseEvent = GroupSysDecreaseEvent.Result(decrease.GroupUin, decrease.MemberUid, Encoding.UTF8.GetString(decrease.Operator.AsSpan()), decrease.DecreaseType); + } extraEvents.Add(decreaseEvent); break; }