From 8bbcc19e9f88ab62b205f684cdd3cb8e0b2efc23 Mon Sep 17 00:00:00 2001 From: CwkDark <177549718+CwkDark@users.noreply.github.com> Date: Thu, 29 Aug 2024 13:45:17 +0800 Subject: [PATCH] [All] GroupRecallEvent add tip (#557) --- .../Event/EventArg/GroupRecallEvent.cs | 19 ++++++++------- .../Logic/Implementation/MessagingLogic.cs | 2 +- .../Event/Notify/GroupSysRecallEvent.cs | 19 ++++++++------- .../Packets/Message/Notify/GroupRecall.cs | 24 ++++++++++++------- .../Service/Message/PushMessageService.cs | 12 ++++++++-- .../Core/Entity/Notify/OneBotGroupRecall.cs | 2 ++ Lagrange.OneBot/Core/Notify/NotifyService.cs | 3 ++- 7 files changed, 53 insertions(+), 28 deletions(-) diff --git a/Lagrange.Core/Event/EventArg/GroupRecallEvent.cs b/Lagrange.Core/Event/EventArg/GroupRecallEvent.cs index 64361a0dd..401521a40 100644 --- a/Lagrange.Core/Event/EventArg/GroupRecallEvent.cs +++ b/Lagrange.Core/Event/EventArg/GroupRecallEvent.cs @@ -3,18 +3,20 @@ namespace Lagrange.Core.Event.EventArg; public class GroupRecallEvent : EventBase { public uint GroupUin { get; } - + public uint AuthorUin { get; } - + public uint OperatorUin { get; } - + public uint Sequence { get; } - + public uint Time { get; } - + public uint Random { get; } - public GroupRecallEvent(uint groupUin, uint authorUin, uint operatorUin, uint sequence, uint time, uint random) + public string Tip { get; } + + public GroupRecallEvent(uint groupUin, uint authorUin, uint operatorUin, uint sequence, uint time, uint random, string tip) { GroupUin = groupUin; AuthorUin = authorUin; @@ -22,7 +24,8 @@ public GroupRecallEvent(uint groupUin, uint authorUin, uint operatorUin, uint se Sequence = sequence; Time = time; Random = random; - - EventMessage = $"{nameof(GroupRecallEvent)}: {GroupUin} | {AuthorUin} | {OperatorUin} | ({Sequence} | {Time} | {Random})"; + Tip = tip; + + EventMessage = $"{nameof(GroupRecallEvent)}: {GroupUin} | {AuthorUin} | {OperatorUin} | ({Sequence} | {Time} | {Random} | {Tip})"; } } \ No newline at end of file diff --git a/Lagrange.Core/Internal/Context/Logic/Implementation/MessagingLogic.cs b/Lagrange.Core/Internal/Context/Logic/Implementation/MessagingLogic.cs index b5bffce80..98839d1c0 100644 --- a/Lagrange.Core/Internal/Context/Logic/Implementation/MessagingLogic.cs +++ b/Lagrange.Core/Internal/Context/Logic/Implementation/MessagingLogic.cs @@ -165,7 +165,7 @@ public override async Task Incoming(ProtocolEvent e) uint authorUin = await Collection.Business.CachingLogic.ResolveUin(recall.GroupUin, recall.AuthorUid) ?? 0; uint operatorUin = 0; if (recall.OperatorUid != null) operatorUin = await Collection.Business.CachingLogic.ResolveUin(recall.GroupUin, recall.OperatorUid) ?? 0; - var recallArgs = new GroupRecallEvent(recall.GroupUin, authorUin, operatorUin, recall.Sequence, recall.Time, recall.Random); + var recallArgs = new GroupRecallEvent(recall.GroupUin, authorUin, operatorUin, recall.Sequence, recall.Time, recall.Random, recall.Tip); Collection.Invoker.PostEvent(recallArgs); break; } diff --git a/Lagrange.Core/Internal/Event/Notify/GroupSysRecallEvent.cs b/Lagrange.Core/Internal/Event/Notify/GroupSysRecallEvent.cs index f5cad16cb..4c612452c 100644 --- a/Lagrange.Core/Internal/Event/Notify/GroupSysRecallEvent.cs +++ b/Lagrange.Core/Internal/Event/Notify/GroupSysRecallEvent.cs @@ -3,18 +3,20 @@ namespace Lagrange.Core.Internal.Event.Notify; internal class GroupSysRecallEvent : ProtocolEvent { public uint GroupUin { get; } - + public string AuthorUid { get; } - + public string? OperatorUid { get; } - + public uint Sequence { get; } - + public uint Time { get; } - + public uint Random { get; } - private GroupSysRecallEvent(uint groupUin, string authorUid, string? operatorUid, uint sequence, uint time, uint random) : base(0) + public string Tip { get; } + + private GroupSysRecallEvent(uint groupUin, string authorUid, string? operatorUid, uint sequence, uint time, uint random, string tip) : base(0) { GroupUin = groupUin; AuthorUid = authorUid; @@ -22,8 +24,9 @@ private GroupSysRecallEvent(uint groupUin, string authorUid, string? operatorUid Sequence = sequence; Time = time; Random = random; + Tip = tip; } - public static GroupSysRecallEvent Result(uint groupUin, string authorUid, string? operatorUid, uint sequence, uint time, uint random) - => new(groupUin, authorUid, operatorUid, sequence, time, random); + public static GroupSysRecallEvent Result(uint groupUin, string authorUid, string? operatorUid, uint sequence, uint time, uint random, string tip) + => new(groupUin, authorUid, operatorUid, sequence, time, random, tip); } \ No newline at end of file diff --git a/Lagrange.Core/Internal/Packets/Message/Notify/GroupRecall.cs b/Lagrange.Core/Internal/Packets/Message/Notify/GroupRecall.cs index a17110531..fb7550aa1 100644 --- a/Lagrange.Core/Internal/Packets/Message/Notify/GroupRecall.cs +++ b/Lagrange.Core/Internal/Packets/Message/Notify/GroupRecall.cs @@ -8,28 +8,36 @@ namespace Lagrange.Core.Internal.Packets.Message.Notify; internal class GroupRecall { [ProtoMember(1)] public string? OperatorUid { get; set; } - + [ProtoMember(3)] public List RecallMessages { get; set; } - + [ProtoMember(5)] public byte[] UserDef { get; set; } - + [ProtoMember(6)] public int GroupType { get; set; } - + [ProtoMember(7)] public int OpType { get; set; } + + [ProtoMember(9)] public TipInfo? TipInfo { get; set; } } [ProtoContract] internal class RecallMessage { [ProtoMember(1)] public uint Sequence { get; set; } - + [ProtoMember(2)] public uint Time { get; set; } - + [ProtoMember(3)] public uint Random { get; set; } - + [ProtoMember(4)] public uint Type { get; set; } [ProtoMember(5)] public uint Flag { get; set; } - + [ProtoMember(6)] public string AuthorUid { get; set; } +} + +[ProtoContract] +internal class TipInfo +{ + [ProtoMember(2)] public string Tip { 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 127156768..8b5f0bbd4 100644 --- a/Lagrange.Core/Internal/Service/Message/PushMessageService.cs +++ b/Lagrange.Core/Internal/Service/Message/PushMessageService.cs @@ -155,7 +155,15 @@ private static void ProcessEvent0x2DC(Span payload, PushMsg msg, List(proto); var meta = recall.Recall.RecallMessages[0]; - var groupRecallEvent = GroupSysRecallEvent.Result(recall.GroupUin, meta.AuthorUid, recall.Recall.OperatorUid, meta.Sequence, meta.Time, meta.Random); + var groupRecallEvent = GroupSysRecallEvent.Result( + recall.GroupUin, + meta.AuthorUid, + recall.Recall.OperatorUid, + meta.Sequence, + meta.Time, + meta.Random, + recall?.Recall.TipInfo?.Tip ?? "" + ); extraEvents.Add(groupRecallEvent); break; } @@ -204,7 +212,7 @@ private static void ProcessEvent0x2DC(Span payload, PushMsg msg, List