forked from LagrangeDev/Lagrange.Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[All] Try to simply parse
MsgPush.PushGroupProMsg
- Loading branch information
Showing
10 changed files
with
205 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Lagrange.Core.Message; | ||
|
||
namespace Lagrange.Core.Event.EventArg; | ||
|
||
public class GroupProMessageEvent : EventBase | ||
{ | ||
public MessageChain Chain { get; set; } | ||
|
||
public GroupProMessageEvent(MessageChain chain) | ||
{ | ||
Chain = chain; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
using Lagrange.Core.Internal.Packets.System; | ||
using ProtoBuf; | ||
|
||
namespace Lagrange.Core.Internal.Packets.Message; | ||
|
||
#pragma warning disable CS8618 | ||
|
||
[ProtoContract] | ||
internal class PushGroupProMsg | ||
{ | ||
[ProtoMember(1)] public PushGroupProMsgBody Message { get; set; } | ||
|
||
[ProtoMember(3)] public int? Status { get; set; } | ||
|
||
[ProtoMember(4)] public NTSysEvent? NtEvent { get; set; } | ||
|
||
[ProtoMember(5)] public int? PingFLag { get; set; } | ||
|
||
[ProtoMember(9)] public int? GeneralFlag { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class PushGroupProMsgBody | ||
{ | ||
[ProtoMember(1)] public Unknown1 Unknown1 { get; set; } | ||
|
||
[ProtoMember(2)] public PushGroupProMsgContentHead ContentHead { get; set; } | ||
|
||
[ProtoMember(3)] public MessageBody? Body { get; set; } | ||
|
||
[ProtoMember(4)] public Unknown4? Unknown4 { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class Unknown1 | ||
{ | ||
[ProtoMember(1)] public Unknown1Field1? Field1 { get; set; } | ||
|
||
[ProtoMember(2)] public Unknown1Field2? Field2 { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class Unknown1Field1 | ||
{ | ||
[ProtoMember(1)] public ulong? GuildId { get; set; } | ||
|
||
[ProtoMember(4)] public ulong? SenderId { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class Unknown1Field2 | ||
{ | ||
[ProtoMember(4)] public uint? Seq { get; set; } | ||
} | ||
|
||
|
||
[ProtoContract] | ||
internal class PushGroupProMsgContentHead | ||
{ | ||
[ProtoMember(1)] public uint Type { get; set; } | ||
|
||
[ProtoMember(2)] public uint? SubType { get; set; } | ||
|
||
[ProtoMember(3)] public uint? DivSeq { get; set; } | ||
|
||
[ProtoMember(4)] public long? MsgId { get; set; } | ||
|
||
[ProtoMember(5)] public uint? Sequence { get; set; } | ||
|
||
[ProtoMember(6)] public long? Timestamp { get; set; } | ||
|
||
[ProtoMember(7)] public long? Field7 { get; set; } | ||
|
||
[ProtoMember(8)] public uint? Field8 { get; set; } | ||
|
||
[ProtoMember(9)] public uint? Field9 { get; set; } | ||
|
||
[ProtoMember(11)] public uint? FriendSequence { get; set; } | ||
|
||
[ProtoMember(12)] public ulong? NewId { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class Unknown4 | ||
{ | ||
[ProtoMember(1)] public string? SenderNickName { get; set; } | ||
|
||
[ProtoMember(2)] public string? GuildName { get; set; } | ||
|
||
[ProtoMember(3)] public string? SubGuildName { get; set; } | ||
|
||
[ProtoMember(8)] public string? SenderGuildName { get; set; } | ||
|
||
[ProtoMember(9)] public uint? Timestamp { get; set; } | ||
} |
32 changes: 32 additions & 0 deletions
32
Lagrange.Core/Internal/Service/Message/PushGroupProMessageService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Lagrange.Core.Common; | ||
using Lagrange.Core.Common.Entity; | ||
using Lagrange.Core.Internal.Event; | ||
using Lagrange.Core.Internal.Event.Message; | ||
using Lagrange.Core.Internal.Packets.Message; | ||
using Lagrange.Core.Message; | ||
using static Lagrange.Core.Message.MessageChain; | ||
using ProtoBuf; | ||
|
||
// ReSharper disable InconsistentNaming | ||
|
||
namespace Lagrange.Core.Internal.Service.Message; | ||
|
||
[EventSubscribe(typeof(PushMessageEvent))] | ||
[Service("MsgPush.PushGroupProMsg")] | ||
internal class PushGroupProMessageService : BaseService<PushMessageEvent> | ||
{ | ||
protected override bool Parse(Span<byte> input, BotKeystore keystore, BotAppInfo appInfo, BotDeviceInfo device, | ||
out PushMessageEvent output, out List<ProtocolEvent>? extraEvents) | ||
{ | ||
var message = Serializer.Deserialize<PushGroupProMsg>(input); | ||
var chain = MessagePacker.Parse(message.Message); | ||
// patch, what i can say | ||
chain.Type = MessageType.GroupPro; | ||
chain.GroupMemberInfo = new BotGroupMember(); | ||
chain.GroupMemberInfo.MemberName = message.Message.Unknown4?.SenderNickName ?? ""; | ||
chain.GroupMemberInfo.Uin = (uint)(message.Message.Unknown1.Field1?.SenderId ?? 0 % ((ulong)uint.MaxValue + 1)); | ||
output = PushMessageEvent.Create(chain); | ||
extraEvents = new List<ProtocolEvent>(); | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters