Skip to content

Commit 6825c5e

Browse files
committed
[Core] remove dupe code
1 parent f9802ec commit 6825c5e

9 files changed

Lines changed: 10 additions & 82 deletions

File tree

Lagrange.Core/Common/Entity/BotGroupNotificationType.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ namespace Lagrange.Core.Common.Entity;
33
public enum BotGroupNotificationType
44
{
55
Join = 1,
6+
GroupInvite = 2,
67
SetAdmin = 3,
78
KickOther = 6,
89
KickSelf = 7,

Lagrange.Core/Common/Interface/OperationExt.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ public static Task<List<BotGroupNotificationBase>> FetchFilteredGroupNotificatio
3636
public static Task<BotStranger> FetchStranger(this BotContext context, long uin) =>
3737
context.EventContext.GetLogic<OperationLogic>().FetchStranger(uin);
3838

39-
public static Task SetGroupNotification(this BotContext context, long groupUin, ulong sequence, BotGroupNotificationType type, bool isFiltered, GroupNotificationOperate operate, string message = "") =>
39+
public static Task SetGroupNotification(this BotContext context, long groupUin, long sequence, BotGroupNotificationType type, bool isFiltered, GroupNotificationOperate operate, string message = "") =>
4040
context.EventContext.GetLogic<OperationLogic>().SetGroupNotification(groupUin, sequence, type, isFiltered, operate, message);
4141
}

Lagrange.Core/Internal/Events/System/SetFilteredGroupNotificationEvent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace Lagrange.Core.Internal.Events.System;
44

5-
internal class SetFilteredGroupNotificationEventReq(long groupUin, ulong sequence, BotGroupNotificationType type, GroupNotificationOperate operate, string message) : ProtocolEvent
5+
internal class SetFilteredGroupNotificationEventReq(long groupUin, long sequence, BotGroupNotificationType type, GroupNotificationOperate operate, string message) : ProtocolEvent
66
{
77
public long GroupUin { get; } = groupUin;
88

9-
public ulong Sequence { get; } = sequence;
9+
public long Sequence { get; } = sequence;
1010

1111
public BotGroupNotificationType Type { get; } = type;
1212

Lagrange.Core/Internal/Events/System/SetGroupInviteSelfAcceptEvent.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

Lagrange.Core/Internal/Events/System/SetGroupNotificationEvent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace Lagrange.Core.Internal.Events.System;
44

5-
internal class SetGroupNotificationEventReq(long groupUin, ulong sequence, BotGroupNotificationType type, GroupNotificationOperate operate, string message) : ProtocolEvent
5+
internal class SetGroupNotificationEventReq(long groupUin, long sequence, BotGroupNotificationType type, GroupNotificationOperate operate, string message) : ProtocolEvent
66
{
77
public long GroupUin { get; } = groupUin;
88

9-
public ulong Sequence { get; } = sequence;
9+
public long Sequence { get; } = sequence;
1010

1111
public BotGroupNotificationType Type { get; } = type;
1212

Lagrange.Core/Internal/Logic/OperationLogic.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public async Task GroupMemberRename(long groupUin, long targetUin, string name)
5656

5757
public async Task SetGroupInviteSelfAccept(long groupUin, long sequence)
5858
{
59-
await context.EventContext.SendEvent<SetGroupInviteSelfAcceptEventResp>(new SetGroupInviteSelfAcceptEventReq(groupUin, sequence));
59+
await context.EventContext.SendEvent<SetGroupNotificationEventReq>(new SetGroupNotificationEventReq(groupUin, sequence, BotGroupNotificationType.GroupInvite, GroupNotificationOperate.Allow, String.Empty));
6060
}
6161

6262
public async Task GroupQuit(long groupUin)
@@ -252,7 +252,8 @@ public async Task<BotStranger> FetchStranger(long uid)
252252
return resp.Stranger;
253253
}
254254

255-
public async Task SetGroupNotification(long groupUin, ulong sequence, BotGroupNotificationType type, bool isFiltered, GroupNotificationOperate operate, string message)
255+
public async Task SetGroupNotification(long groupUin, long sequence, BotGroupNotificationType type, bool isFiltered,
256+
GroupNotificationOperate operate, string message)
256257
{
257258
if (isFiltered)
258259
{

Lagrange.Core/Internal/Packets/Service/Oidb_0x10C8.cs

Lines changed: 0 additions & 26 deletions
This file was deleted.

Lagrange.Core/Internal/Packets/Service/SetGroupNotification.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public partial class SetGroupNotificationRequest
1515
[ProtoPackable]
1616
public partial class SetGroupNotificationRequestBody
1717
{
18-
[ProtoMember(1)] public ulong Sequence { get; set; }
18+
[ProtoMember(1)] public long Sequence { get; set; }
1919

2020
[ProtoMember(2)] public ulong Type { get; set; }
2121

Lagrange.Core/Internal/Services/System/SetGroupInviteAcceptService.cs

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)