Add invitor_id field to group request events per OneBot 11 standard

Co-authored-by: sj817 <74231782+sj817@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-11-07 10:37:40 +00:00
parent 79ead4df57
commit 63fdff45e0
3 changed files with 12 additions and 6 deletions

View File

@ -1434,7 +1434,8 @@ export class OneBotMsgApi {
+await this.core.apis.UserApi.getUinByUidV2(groupInvite.invitorUid), +await this.core.apis.UserApi.getUinByUidV2(groupInvite.invitorUid),
'invite', 'invite',
'', '',
request_seq request_seq,
+await this.core.apis.UserApi.getUinByUidV2(groupInvite.invitorUid)
); );
} else if (SysMessage.contentHead.type === 528 && SysMessage.contentHead.subType === 39 && SysMessage.body?.msgContent) { } else if (SysMessage.contentHead.type === 528 && SysMessage.contentHead.subType === 39 && SysMessage.body?.msgContent) {
return await this.obContext.apis.UserApi.parseLikeEvent(SysMessage.body?.msgContent); return await this.obContext.apis.UserApi.parseLikeEvent(SysMessage.body?.msgContent);

View File

@ -9,13 +9,15 @@ export class OB11GroupRequestEvent extends OB11BaseRequestEvent {
comment: string; comment: string;
flag: string; flag: string;
sub_type: string; sub_type: string;
invitor_id?: number;
constructor (core: NapCatCore, groupId: number, userId: number, sub_type: string, comment: string, flag: string) { constructor (core: NapCatCore, groupId: number, userId: number, sub_type: string, comment: string, flag: string, invitorId?: number) {
super(core); super(core);
this.group_id = groupId; this.group_id = groupId;
this.user_id = userId; this.user_id = userId;
this.sub_type = sub_type; this.sub_type = sub_type;
this.comment = comment; this.comment = comment;
this.flag = flag; this.flag = flag;
this.invitor_id = invitorId;
} }
} }

View File

@ -466,13 +466,15 @@ export class NapCatOneBot11Adapter {
notify.status === GroupNotifyMsgStatus.KUNHANDLE notify.status === GroupNotifyMsgStatus.KUNHANDLE
) { ) {
this.context.logger.logDebug(`收到邀请我加群通知:${notify}`); this.context.logger.logDebug(`收到邀请我加群通知:${notify}`);
const inviterUin = +await this.core.apis.UserApi.getUinByUidV2(notify.user2.uid);
const groupInviteEvent = new OB11GroupRequestEvent( const groupInviteEvent = new OB11GroupRequestEvent(
this.core, this.core,
+notify.group.groupCode, +notify.group.groupCode,
+await this.core.apis.UserApi.getUinByUidV2(notify.user2.uid), inviterUin,
'invite', 'invite',
notify.postscript, notify.postscript,
flag flag,
inviterUin
); );
this.networkManager this.networkManager
.emitEvent(groupInviteEvent) .emitEvent(groupInviteEvent)
@ -488,9 +490,10 @@ export class NapCatOneBot11Adapter {
this.core, this.core,
+notify.group.groupCode, +notify.group.groupCode,
+await this.core.apis.UserApi.getUinByUidV2(notify.user1.uid), +await this.core.apis.UserApi.getUinByUidV2(notify.user1.uid),
'add', 'invite',
notify.postscript, notify.postscript,
flag flag,
+await this.core.apis.UserApi.getUinByUidV2(notify.user2.uid)
); );
this.networkManager this.networkManager
.emitEvent(groupInviteEvent) .emitEvent(groupInviteEvent)