diff --git a/src/onebot/action/group/GetGroupMemberInfo.ts b/src/onebot/action/group/GetGroupMemberInfo.ts index d4c8e6f3..aa0bd753 100644 --- a/src/onebot/action/group/GetGroupMemberInfo.ts +++ b/src/onebot/action/group/GetGroupMemberInfo.ts @@ -41,9 +41,28 @@ class GetGroupMemberInfo extends OneBotAction { } async _handle (payload: Payload) { - // 处理 'all' 的特殊情况,用于 @全体成员 + // 处理 @全体成员 的特殊情况 if (payload.user_id === 'all') { - throw new Error('无法获取全体成员的信息,user_id 不能为 "all"'); + return { + group_id: +payload.group_id, + user_id: 0, + nickname: '全体成员', + card: '全体成员', + sex: 'unknown' as const, + age: 0, + area: '', + level: '0', + qq_level: 0, + join_time: 0, + last_sent_time: 0, + title_expire_time: 0, + unfriendly: false, + card_changeable: false, + is_robot: false, + shut_up_timestamp: 0, + role: 'member' as const, + title: '', + }; } const isNocache = this.parseBoolean(payload.no_cache ?? true); diff --git a/src/onebot/action/group/SetGroupAdmin.ts b/src/onebot/action/group/SetGroupAdmin.ts index 6ca9b3d4..a313aa4b 100644 --- a/src/onebot/action/group/SetGroupAdmin.ts +++ b/src/onebot/action/group/SetGroupAdmin.ts @@ -16,10 +16,6 @@ export default class SetGroupAdmin extends OneBotAction { override payloadSchema = SchemaData; async _handle (payload: Payload): Promise { - if (payload.user_id === 'all') { - throw new Error('无法设置全体成员为管理员,user_id 不能为 "all"'); - } - const enable = typeof payload.enable === 'string' ? payload.enable === 'true' : !!payload.enable; const uid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString()); if (!uid) throw new Error('get Uid Error'); diff --git a/src/onebot/action/group/SetGroupBan.ts b/src/onebot/action/group/SetGroupBan.ts index 42eadf18..4bc4241a 100644 --- a/src/onebot/action/group/SetGroupBan.ts +++ b/src/onebot/action/group/SetGroupBan.ts @@ -14,10 +14,6 @@ export default class SetGroupBan extends OneBotAction { override actionName = ActionName.SetGroupBan; override payloadSchema = SchemaData; async _handle (payload: Payload): Promise { - if (payload.user_id === 'all') { - throw new Error('无法禁言全体成员,请使用 set_group_whole_ban,user_id 不能为 "all"'); - } - const uid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString()); if (!uid) throw new Error('uid error'); const member_role = (await this.core.apis.GroupApi.getGroupMemberEx(payload.group_id.toString(), uid, true))?.role; diff --git a/src/onebot/action/group/SetGroupCard.ts b/src/onebot/action/group/SetGroupCard.ts index ce242075..43adda1d 100644 --- a/src/onebot/action/group/SetGroupCard.ts +++ b/src/onebot/action/group/SetGroupCard.ts @@ -15,10 +15,6 @@ export default class SetGroupCard extends OneBotAction { override payloadSchema = SchemaData; async _handle (payload: Payload): Promise { - if (payload.user_id === 'all') { - throw new Error('无法设置全体成员的群名片,user_id 不能为 "all"'); - } - const member = await this.core.apis.GroupApi.getGroupMember(payload.group_id.toString(), payload.user_id.toString()); if (member) await this.core.apis.GroupApi.setMemberCard(payload.group_id.toString(), member.uid, payload.card || ''); return null; diff --git a/src/onebot/action/group/SetGroupKick.ts b/src/onebot/action/group/SetGroupKick.ts index f1d93676..a9f2cb1e 100644 --- a/src/onebot/action/group/SetGroupKick.ts +++ b/src/onebot/action/group/SetGroupKick.ts @@ -15,10 +15,6 @@ export default class SetGroupKick extends OneBotAction { override payloadSchema = SchemaData; async _handle (payload: Payload): Promise { - if (payload.user_id === 'all') { - throw new Error('无法踢出全体成员,user_id 不能为 "all"'); - } - const rejectReq = payload.reject_add_request?.toString() === 'true'; const uid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString()); if (!uid) throw new Error('get Uid Error');