-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Core] Implemented GroupSetMessageReaction
- Loading branch information
1 parent
c7c676e
commit fdb1ca8
Showing
4 changed files
with
77 additions
and
0 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
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
24 changes: 24 additions & 0 deletions
24
Lagrange.Core/Internal/Event/Action/GroupSetReactionEvent.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,24 @@ | ||
namespace Lagrange.Core.Internal.Event.Action; | ||
|
||
internal class GroupSetReactionEvent : ProtocolEvent | ||
{ | ||
public uint GroupUin { get; } | ||
|
||
public uint Sequence { get; } | ||
|
||
public string Code { get; } = string.Empty; | ||
|
||
private GroupSetReactionEvent(uint groupUin, uint sequence, string code) : base(true) | ||
{ | ||
GroupUin = groupUin; | ||
Sequence = sequence; | ||
Code = code; | ||
} | ||
|
||
private GroupSetReactionEvent(int resultCode) : base(resultCode) { } | ||
|
||
public static GroupSetReactionEvent Create(uint groupUin, uint sequence, string code) | ||
=> new(groupUin, sequence, code); | ||
|
||
public static GroupSetReactionEvent Result(int resultCode) => new(resultCode); | ||
} |
43 changes: 43 additions & 0 deletions
43
Lagrange.Core/Internal/Service/Action/GroupSetReactionService.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,43 @@ | ||
using Lagrange.Core.Common; | ||
using Lagrange.Core.Internal.Event; | ||
using Lagrange.Core.Internal.Event.Action; | ||
using Lagrange.Core.Internal.Packets.Service.Oidb; | ||
using Lagrange.Core.Internal.Packets.Service.Oidb.Request; | ||
using Lagrange.Core.Utility.Binary; | ||
using Lagrange.Core.Utility.Extension; | ||
using ProtoBuf; | ||
|
||
namespace Lagrange.Core.Internal.Service.Action; | ||
|
||
[EventSubscribe(typeof(GroupSetReactionEvent))] | ||
[Service("OidbSvcTrpcTcp.0x9082_1")] | ||
internal class GroupSetReactionService : BaseService<GroupSetReactionEvent> | ||
{ | ||
protected override bool Build(GroupSetReactionEvent input, BotKeystore keystore, BotAppInfo appInfo, BotDeviceInfo device, | ||
out BinaryPacket output, out List<BinaryPacket>? extraPackets) | ||
{ | ||
var packet = new OidbSvcTrpcTcpBase<OidbSvcTrpcTcp0x9082_1>(new OidbSvcTrpcTcp0x9082_1 | ||
{ | ||
GroupUin = input.GroupUin, | ||
Sequence = input.Sequence, | ||
Code = input.Code, | ||
Field5 = true, | ||
Field6 = false, | ||
Field7 = false | ||
}, false, true); | ||
|
||
output = packet.Serialize(); | ||
extraPackets = null; | ||
return true; | ||
} | ||
|
||
protected override bool Parse(Span<byte> input, BotKeystore keystore, BotAppInfo appInfo, BotDeviceInfo device, | ||
out GroupSetReactionEvent output, out List<ProtocolEvent>? extraEvents) | ||
{ | ||
var payload = Serializer.Deserialize<OidbSvcTrpcTcpBase<byte[]>>(input); | ||
|
||
output = GroupSetReactionEvent.Result((int)payload.ErrorCode); | ||
extraEvents = null; | ||
return true; | ||
} | ||
} |