-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[All] supported reduce group reaction (#619)
Co-authored-by: DarkRRb <[email protected]>
- Loading branch information
Showing
9 changed files
with
107 additions
and
28 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
12 changes: 6 additions & 6 deletions
12
...nal/Event/Action/GroupSetReactionEvent.cs → ...nal/Event/Action/GroupAddReactionEvent.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 |
---|---|---|
@@ -1,24 +1,24 @@ | ||
namespace Lagrange.Core.Internal.Event.Action; | ||
|
||
internal class GroupSetReactionEvent : ProtocolEvent | ||
internal class GroupAddReactionEvent : 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) | ||
private GroupAddReactionEvent(uint groupUin, uint sequence, string code) : base(true) | ||
{ | ||
GroupUin = groupUin; | ||
Sequence = sequence; | ||
Code = code; | ||
} | ||
|
||
private GroupSetReactionEvent(int resultCode) : base(resultCode) { } | ||
private GroupAddReactionEvent(int resultCode) : base(resultCode) { } | ||
|
||
public static GroupSetReactionEvent Create(uint groupUin, uint sequence, string code) | ||
public static GroupAddReactionEvent Create(uint groupUin, uint sequence, string code) | ||
=> new(groupUin, sequence, code); | ||
|
||
public static GroupSetReactionEvent Result(int resultCode) => new(resultCode); | ||
public static GroupAddReactionEvent Result(int resultCode) => new(resultCode); | ||
} |
24 changes: 24 additions & 0 deletions
24
Lagrange.Core/Internal/Event/Action/GroupReduceReactionEvent.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 GroupReduceReactionEvent : ProtocolEvent | ||
{ | ||
public uint GroupUin { get; } | ||
|
||
public uint Sequence { get; } | ||
|
||
public string Code { get; } = string.Empty; | ||
|
||
private GroupReduceReactionEvent(uint groupUin, uint sequence, string code) : base(true) | ||
{ | ||
GroupUin = groupUin; | ||
Sequence = sequence; | ||
Code = code; | ||
} | ||
|
||
private GroupReduceReactionEvent(int resultCode) : base(resultCode) { } | ||
|
||
public static GroupReduceReactionEvent Create(uint groupUin, uint sequence, string code) | ||
=> new(groupUin, sequence, code); | ||
|
||
public static GroupReduceReactionEvent Result(int resultCode) => new(resultCode); | ||
} |
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
42 changes: 42 additions & 0 deletions
42
Lagrange.Core/Internal/Service/Action/GroupReduceReactionService.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,42 @@ | ||
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.Extension; | ||
using ProtoBuf; | ||
|
||
namespace Lagrange.Core.Internal.Service.Action; | ||
|
||
[EventSubscribe(typeof(GroupReduceReactionEvent))] | ||
[Service("OidbSvcTrpcTcp.0x9082_2")] | ||
internal class GroupReduceReactionService : BaseService<GroupReduceReactionEvent> | ||
{ | ||
protected override bool Build(GroupReduceReactionEvent input, BotKeystore keystore, BotAppInfo appInfo, | ||
BotDeviceInfo device, out Span<byte> output, out List<Memory<byte>>? extraPackets) | ||
{ | ||
var packet = new OidbSvcTrpcTcpBase<OidbSvcTrpcTcp0x9082>(new OidbSvcTrpcTcp0x9082 | ||
{ | ||
GroupUin = input.GroupUin, | ||
Sequence = input.Sequence, | ||
Code = input.Code, | ||
Field5 = true, | ||
Field6 = false, | ||
Field7 = false | ||
}, 0x9082, 2, false, true); | ||
|
||
output = packet.Serialize(); | ||
extraPackets = null; | ||
return true; | ||
} | ||
|
||
protected override bool Parse(Span<byte> input, BotKeystore keystore, BotAppInfo appInfo, BotDeviceInfo device, | ||
out GroupReduceReactionEvent output, out List<ProtocolEvent>? extraEvents) | ||
{ | ||
var payload = Serializer.Deserialize<OidbSvcTrpcTcpBase<byte[]>>(input); | ||
|
||
output = GroupReduceReactionEvent.Result((int)payload.ErrorCode); | ||
extraEvents = null; | ||
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