This commit is contained in:
手瓜一十雪
2024-12-29 22:44:25 +08:00
parent 726a0d0394
commit 5fc5a6f1a6

View File

@@ -994,6 +994,9 @@ export class OneBotMsgApi {
let groupRole = this.core.apis.GroupApi.groupMemberCache.get(groupChange.groupUin.toString())?.get(this.core.selfInfo.uid.toString())?.role; let groupRole = this.core.apis.GroupApi.groupMemberCache.get(groupChange.groupUin.toString())?.get(this.core.selfInfo.uid.toString())?.role;
let isAdminOrOwner = groupRole === 3 || groupRole === 4; let isAdminOrOwner = groupRole === 3 || groupRole === 4;
console.log(Buffer.from(msg).toString('hex'));
if (isAdminOrOwner && !operatorUid) { if (isAdminOrOwner && !operatorUid) {
let dataNotify: GroupNotify | undefined; let dataNotify: GroupNotify | undefined;
await this.core.eventWrapper.registerListen('NodeIKernelGroupListener/onGroupNotifiesUpdated', await this.core.eventWrapper.registerListen('NodeIKernelGroupListener/onGroupNotifiesUpdated',
@@ -1007,8 +1010,9 @@ export class OneBotMsgApi {
return false; return false;
}, 1, 1000).catch(undefined); }, 1, 1000).catch(undefined);
if (dataNotify) { if (dataNotify) {
operatorUid = dataNotify.actionUser.uid ?? dataNotify.user2.uid; operatorUid = !!dataNotify.actionUser.uid ? dataNotify.actionUser.uid :dataNotify.user2.uid;
} }
console.log(dataNotify);
} }
return new OB11GroupIncreaseEvent( return new OB11GroupIncreaseEvent(
@@ -1027,6 +1031,7 @@ export class OneBotMsgApi {
let groupRole = this.core.apis.GroupApi.groupMemberCache.get(groupChange.groupUin.toString())?.get(this.core.selfInfo.uid.toString())?.role; let groupRole = this.core.apis.GroupApi.groupMemberCache.get(groupChange.groupUin.toString())?.get(this.core.selfInfo.uid.toString())?.role;
let isAdminOrOwner = groupRole === 3 || groupRole === 4; let isAdminOrOwner = groupRole === 3 || groupRole === 4;
console.log(Buffer.from(msg).toString('hex'));
if (isAdminOrOwner && !operatorUid) { if (isAdminOrOwner && !operatorUid) {
let dataNotify: GroupNotify | undefined; let dataNotify: GroupNotify | undefined;
await this.core.eventWrapper.registerListen('NodeIKernelGroupListener/onGroupNotifiesUpdated', await this.core.eventWrapper.registerListen('NodeIKernelGroupListener/onGroupNotifiesUpdated',
@@ -1039,8 +1044,9 @@ export class OneBotMsgApi {
} }
return false; return false;
}, 1, 1000).catch(undefined); }, 1, 1000).catch(undefined);
console.log(dataNotify);
if (dataNotify) { if (dataNotify) {
operatorUid = dataNotify.actionUser.uid ?? dataNotify.user2.uid; operatorUid = !!dataNotify.actionUser.uid ? dataNotify.actionUser.uid :dataNotify.user2.uid;
} }
} }