fix(protocol): correct group membership notices

Derive group increase approval and invitation subtypes from the member-change operation code instead of actor identity.

Treat voluntary leave field 5 as structured metadata and attribute the operation to the departing member so valid notices are not discarded.

Add protocol and OneBot regression coverage for issue #237.
This commit is contained in:
DrSmoothl committed 2026-07-16 19:41:48 +08:00
1 parent 0503af2fcc
commit 0e3bbc6906
6 files changed
+110 -11

No files matched your search

@@ -27,7 +27,10 @@ type BotOffline = Extract<QQEventVariant, { kind: 'bot_offline' }>;
export function convertGroupMemberJoin(ctx: ConverterContext, event: GroupMemberJoin): JsonObject {
return notice(ctx, event, {
notice_type: 'group_increase',
sub_type: isSameActor(event.operatorUin, event.operatorUid, event.userUin, event.userUid) ? 'approve' : 'invite',
sub_type: event.joinType
?? (isSameActor(event.operatorUin, event.operatorUid, event.userUin, event.userUid)
? 'approve'
: 'invite'),
group_id: event.groupId,
operator_id: event.operatorUin,
user_id: event.userUin,