This commit is contained in:
手瓜一十雪
2025-01-13 19:25:08 +08:00
parent b14d3dd884
commit 7169cff2a5
4 changed files with 5 additions and 15 deletions

View File

@@ -35,13 +35,7 @@ class GetGroupMemberInfo extends OneBotAction<Payload, OB11GroupMember> {
this.core.apis.UserApi.getUserDetailInfo(uid),
]);
if (!member) throw new Error(`群(${payload.group_id})成员${payload.user_id}不存在`);
if (!groupMember && this.core.apis.GroupApi.groupMemberCacheEvent.get(payload.group_id.toString())) {
groupMember = (await this.core.apis.GroupApi.refreshGroupMemberCache(payload.group_id.toString(), true))?.get(uid);
}
if (!groupMember) throw new Error(`群(${payload.group_id})成员${payload.user_id}不存在`);
if (!member || !groupMember) throw new Error(`群(${payload.group_id})成员${payload.user_id}不存在`);
return info ? { ...groupMember, ...member, ...info } : member;
}

View File

@@ -223,7 +223,7 @@ export class OneBotGroupApi {
} else if (element.type === TipGroupElementType.KMEMBERADD) {
// 自己的通知 协议推送为type->85 在这里实现为了避免邀请出现问题
if (element.memberUid == this.core.selfInfo.uid) {
await this.core.apis.GroupApi.refreshGroupMemberCache(msg.peerUid, false);
await this.core.apis.GroupApi.refreshGroupMemberCache(msg.peerUid, true);
return new OB11GroupIncreaseEvent(
this.core,
parseInt(msg.peerUid),

View File

@@ -1022,7 +1022,7 @@ export class OneBotMsgApi {
// 邀请需要解grayTipElement
if (SysMessage.contentHead.type == 33 && SysMessage.body?.msgContent) {
const groupChange = new NapProtoMsg(GroupChange).decode(SysMessage.body.msgContent);
await this.core.apis.GroupApi.refreshGroupMemberCache(groupChange.groupUin.toString(), false);
await this.core.apis.GroupApi.refreshGroupMemberCache(groupChange.groupUin.toString(), true);
let operatorUid = await this.waitGroupNotify(
groupChange.groupUin.toString(),
groupChange.memberUid,
@@ -1052,7 +1052,7 @@ export class OneBotMsgApi {
}, 5000);
// 自己被踢了 5S后回收
} else {
await this.core.apis.GroupApi.refreshGroupMemberCache(groupChange.groupUin.toString(), false);
await this.core.apis.GroupApi.refreshGroupMemberCache(groupChange.groupUin.toString(), true);
}
return new OB11GroupDecreaseEvent(
this.core,
@@ -1063,7 +1063,7 @@ export class OneBotMsgApi {
);
} else if (SysMessage.contentHead.type == 44 && SysMessage.body?.msgContent) {
const groupAmin = new NapProtoMsg(GroupAdmin).decode(SysMessage.body.msgContent);
await this.core.apis.GroupApi.refreshGroupMemberCache(groupAmin.groupUin.toString(), false);
await this.core.apis.GroupApi.refreshGroupMemberCache(groupAmin.groupUin.toString(), true);
let enabled = false;
let uid = '';
if (groupAmin.body.extraEnable != null) {