Skip to content

Commit af18c39

Browse files
authored
[Core] Implemented group join event and group invite event (#34)
1 parent 1361359 commit af18c39

15 files changed

+233
-31
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
namespace Lagrange.Core.Common.Entity;
22

3-
public class BotGroupExitNotification(long group, ulong sequence, long target) : BotGroupNotificationBase(group, sequence, BotGroupNotificationType.Exit, target);
3+
public class BotGroupExitNotification(long groupUin, ulong sequence, long targetUin, string targetUid) : BotGroupNotificationBase(groupUin, sequence, BotGroupNotificationType.Exit, targetUin, targetUid);
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
namespace Lagrange.Core.Common.Entity;
22

3-
public class BotGroupInviteNotification(long group, ulong sequence, long target, BotGroupNotificationState state, long? @operator, long inviter) : BotGroupNotificationBase(group, sequence, BotGroupNotificationType.Invite, target)
3+
public class BotGroupInviteNotification(long group, ulong sequence, long targetUin, string targetUid, BotGroupNotificationState state, long? operatorUin, string? operatorUid, long inviterUin, string inviterUid) : BotGroupNotificationBase(group, sequence, BotGroupNotificationType.Invite, targetUin, targetUid)
44
{
55
public BotGroupNotificationState State { get; } = state;
66

7-
public long? Operator { get; } = @operator;
7+
public long? OperatorUin { get; } = operatorUin;
88

9-
public long Inviter { get; } = inviter;
9+
public string? OperatorUid { get; } = operatorUid;
10+
11+
public long InviterUin { get; } = inviterUin;
12+
13+
public string InviterUid { get; } = inviterUid;
1014
}
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
namespace Lagrange.Core.Common.Entity;
22

3-
public class BotGroupJoinNotification(long group, ulong sequence, long target, BotGroupNotificationState state, long? @operator, string comment) : BotGroupNotificationBase(group, sequence, BotGroupNotificationType.Join, target)
3+
public class BotGroupJoinNotification(long group, ulong sequence, long targetUin, string targetUid, BotGroupNotificationState state, long? operatorUin, string? operatorUid, string comment) : BotGroupNotificationBase(group, sequence, BotGroupNotificationType.Join, targetUin, targetUid)
44
{
55
public BotGroupNotificationState State { get; } = state;
66

7-
public long? Operator { get; } = @operator;
7+
public long? OperatorUin { get; } = operatorUin;
8+
9+
public string? OperatorUid { get; } = operatorUid;
810

911
public string Comment { get; } = comment;
1012
}
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
namespace Lagrange.Core.Common.Entity;
22

3-
public class BotGroupKickNotification(long group, ulong sequence, long target, long @operator) : BotGroupNotificationBase(group, sequence, BotGroupNotificationType.Exit, target)
3+
public class BotGroupKickNotification(long group, ulong sequence, long targetUin, string targetUid, long operatorUin, string operatorUid) : BotGroupNotificationBase(group, sequence, BotGroupNotificationType.Exit, targetUin, targetUid)
44
{
5-
public long Operator { get; } = @operator;
5+
public long Operator { get; } = operatorUin;
6+
7+
public string OperatorUid { get; } = operatorUid;
68
}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
namespace Lagrange.Core.Common.Entity;
22

3-
public abstract class BotGroupNotificationBase(long group, ulong sequence, BotGroupNotificationType type, long target)
3+
public abstract class BotGroupNotificationBase(long groupUin, ulong sequence, BotGroupNotificationType type, long targetUin, string targetUid)
44
{
5-
public long Group { get; } = group;
5+
public long GroupUin { get; } = groupUin;
66

77
public ulong Sequence { get; } = sequence;
88

99
public BotGroupNotificationType Type { get; } = type;
1010

11-
public long Target { get; } = target;
11+
public long TargetUin { get; } = targetUin;
12+
13+
public string TargetUid { get; } = targetUid;
1214
}

Lagrange.Core/Common/Entity/BotGroupNotificationType.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ namespace Lagrange.Core.Common.Entity;
33
public enum BotGroupNotificationType
44
{
55
Join = 1,
6-
Exit = 13,
6+
SetAdmin = 3,
77
KickOther = 6,
88
KickSelf = 7,
9+
Exit = 13,
10+
UnsetAdmin = 16,
911
Invite = 22
1012
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Lagrange.Core.Common.Entity;
2+
3+
public class BotGroupUnsetAdminNotification(long groupUin, ulong sequence, long targetUin, string targetUid, long operatorUin, string operatorUid) : BotGroupNotificationBase(groupUin, sequence, BotGroupNotificationType.UnsetAdmin, targetUin, targetUid)
4+
{
5+
public long Operator { get; } = operatorUin;
6+
7+
public string OperatorUid { get; } = operatorUid;
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Lagrange.Core.Common.Entity;
2+
3+
public class BotGroupSetAdminNotification(long group, ulong sequence, long targetUin, string targetUid, long operatorUin, string operatorUid) : BotGroupNotificationBase(group, sequence, BotGroupNotificationType.SetAdmin, targetUin, targetUid)
4+
{
5+
public long Operator { get; } = operatorUin;
6+
7+
public string OperatorUid { get; } = operatorUid;
8+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Lagrange.Core.Common.Entity;
2+
3+
namespace Lagrange.Core.Events.EventArgs;
4+
5+
public class BotGroupInviteNotificationEvent(BotGroupInviteNotification notification) : EventBase
6+
{
7+
public BotGroupInviteNotification Notification { get; } = notification;
8+
9+
public override string ToEventMessage() => $"{nameof(BotGroupInviteNotificationEvent)} Group {Notification.GroupUin} Inviter {Notification.InviterUin} Target {Notification.TargetUin}";
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Lagrange.Core.Common.Entity;
2+
3+
namespace Lagrange.Core.Events.EventArgs;
4+
5+
public class BotGroupJoinNotificationEvent(BotGroupJoinNotification notification) : EventBase
6+
{
7+
public BotGroupJoinNotification Notification { get; } = notification;
8+
9+
public override string ToEventMessage() => $"{nameof(BotGroupJoinNotificationEvent)} Group {Notification.GroupUin} Target {Notification.TargetUin}";
10+
}

0 commit comments

Comments
 (0)