diff --git a/packages/napcat-core/apis/group.ts b/packages/napcat-core/apis/group.ts index 1aa9f8b0d..3400a9d98 100644 --- a/packages/napcat-core/apis/group.ts +++ b/packages/napcat-core/apis/group.ts @@ -25,7 +25,7 @@ export class NTQQGroupApi { groupMemberCache: Map> = new Map>(); essenceLRU = new LimitedHashTable(1000); // psKey 滑动缓存,TTL 60 秒,惰性删除(不主动清理,等下次访问检测到过期再刷新) - private _qunPskeyCache: { value: string; expireAt: number } | null = null; + private _qunPskeyCache: { value: string; expireAt: number; } | null = null; constructor (context: InstanceContext, core: NapCatCore) { this.context = context; @@ -482,8 +482,8 @@ export class NTQQGroupApi { return this.context.session.getGroupService().modifyMemberRole(groupCode, memberUid, role); } - async setGroupName (groupCode: string, groupName: string) { - return this.context.session.getGroupService().modifyGroupName(groupCode, groupName, false); + async setGroupName (groupCode: string, groupName: string, isNormalMember: boolean = false) { + return this.context.session.getGroupService().modifyGroupName(groupCode, groupName, isNormalMember); } async publishGroupBulletin (groupCode: string, content: string, picInfo: { diff --git a/packages/napcat-onebot/action/group/SetGroupName.ts b/packages/napcat-onebot/action/group/SetGroupName.ts index cd9ed2e8a..1cf1413f8 100644 --- a/packages/napcat-onebot/action/group/SetGroupName.ts +++ b/packages/napcat-onebot/action/group/SetGroupName.ts @@ -26,7 +26,10 @@ export default class SetGroupName extends OneBotAction override returnExample = GroupActionsExamples.SetGroupName.response; async _handle (payload: PayloadType): Promise { - const ret = await this.core.apis.GroupApi.setGroupName(payload.group_id.toString(), payload.group_name); + let ret = await this.core.apis.GroupApi.setGroupName(payload.group_id.toString(), payload.group_name); + if (ret.result.toString() === '1287') { + ret = await this.core.apis.GroupApi.setGroupName(payload.group_id.toString(), payload.group_name, true); + } if (ret.result !== 0) { throw new Error(`设置群名称失败 ErrCode: ${ret.result} ErrMsg: ${ret.errMsg}`); }