From 07cab5b8e62c8633f4f2c73daa7773f2fe77d222 Mon Sep 17 00:00:00 2001 From: CrackTC Date: Fri, 6 Dec 2024 12:34:58 +0800 Subject: [PATCH] [Core] fix emoji reaction (#700) --- Lagrange.Core/Internal/Event/Action/GroupAddReactionEvent.cs | 2 ++ Lagrange.Core/Internal/Event/Action/GroupReduceReactionEvent.cs | 2 ++ .../Packets/Service/Oidb/Request/OidbSvcTrpcTcp0x9082.cs | 2 +- .../Internal/Service/Action/GroupAddReactionService.cs | 2 +- .../Internal/Service/Action/GroupReduceReactionService.cs | 2 +- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Lagrange.Core/Internal/Event/Action/GroupAddReactionEvent.cs b/Lagrange.Core/Internal/Event/Action/GroupAddReactionEvent.cs index d735b90ea..c6b848da0 100644 --- a/Lagrange.Core/Internal/Event/Action/GroupAddReactionEvent.cs +++ b/Lagrange.Core/Internal/Event/Action/GroupAddReactionEvent.cs @@ -8,6 +8,8 @@ internal class GroupAddReactionEvent : ProtocolEvent public string Code { get; } = string.Empty; + public bool IsEmoji => Code.Length > 3; + private GroupAddReactionEvent(uint groupUin, uint sequence, string code) : base(true) { GroupUin = groupUin; diff --git a/Lagrange.Core/Internal/Event/Action/GroupReduceReactionEvent.cs b/Lagrange.Core/Internal/Event/Action/GroupReduceReactionEvent.cs index a59a05f5d..005ff674e 100644 --- a/Lagrange.Core/Internal/Event/Action/GroupReduceReactionEvent.cs +++ b/Lagrange.Core/Internal/Event/Action/GroupReduceReactionEvent.cs @@ -8,6 +8,8 @@ internal class GroupReduceReactionEvent : ProtocolEvent public string Code { get; } = string.Empty; + public bool IsEmoji => Code.Length > 3; + private GroupReduceReactionEvent(uint groupUin, uint sequence, string code) : base(true) { GroupUin = groupUin; diff --git a/Lagrange.Core/Internal/Packets/Service/Oidb/Request/OidbSvcTrpcTcp0x9082.cs b/Lagrange.Core/Internal/Packets/Service/Oidb/Request/OidbSvcTrpcTcp0x9082.cs index 347990564..3ea70913f 100644 --- a/Lagrange.Core/Internal/Packets/Service/Oidb/Request/OidbSvcTrpcTcp0x9082.cs +++ b/Lagrange.Core/Internal/Packets/Service/Oidb/Request/OidbSvcTrpcTcp0x9082.cs @@ -16,7 +16,7 @@ internal class OidbSvcTrpcTcp0x9082 [ProtoMember(4)] public string? Code { get; set; } - [ProtoMember(5)] public bool Field5 { get; set; } // true + [ProtoMember(5)] public uint Type { get; set; } // 1 Face 2 Emoji [ProtoMember(6)] public bool Field6 { get; set; } // false diff --git a/Lagrange.Core/Internal/Service/Action/GroupAddReactionService.cs b/Lagrange.Core/Internal/Service/Action/GroupAddReactionService.cs index f36c8900a..d704f6d0d 100644 --- a/Lagrange.Core/Internal/Service/Action/GroupAddReactionService.cs +++ b/Lagrange.Core/Internal/Service/Action/GroupAddReactionService.cs @@ -20,7 +20,7 @@ protected override bool Build(GroupAddReactionEvent input, BotKeystore keystore, GroupUin = input.GroupUin, Sequence = input.Sequence, Code = input.Code, - Field5 = true, + Type = input.IsEmoji ? 2u : 1u, Field6 = false, Field7 = false }, 0x9082, 1, false, true); diff --git a/Lagrange.Core/Internal/Service/Action/GroupReduceReactionService.cs b/Lagrange.Core/Internal/Service/Action/GroupReduceReactionService.cs index 4e9a73acc..2289838f6 100644 --- a/Lagrange.Core/Internal/Service/Action/GroupReduceReactionService.cs +++ b/Lagrange.Core/Internal/Service/Action/GroupReduceReactionService.cs @@ -20,7 +20,7 @@ protected override bool Build(GroupReduceReactionEvent input, BotKeystore keysto GroupUin = input.GroupUin, Sequence = input.Sequence, Code = input.Code, - Field5 = true, + Type = input.IsEmoji ? 2u : 1u, Field6 = false, Field7 = false }, 0x9082, 2, false, true);