From 5c4e1614346f46c846aef02a1ca9267407542966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9B=A7=E5=9B=A7JOJO?= <58727904+jiongjiongJOJO@users.noreply.github.com> Date: Wed, 6 Aug 2025 20:38:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=8F=AF=E9=80=89?= =?UTF-8?q?=E5=8F=82=E6=95=B0=20'count'=20=E5=88=B0=20SetGroupAddRequest?= =?UTF-8?q?=20=E4=BB=A5=E6=94=AF=E6=8C=81=E5=8A=A8=E6=80=81=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E9=80=9A=E7=9F=A5=E6=95=B0=E9=87=8F(#1113=20=E8=A1=A5?= =?UTF-8?q?=E5=85=85)=20(#1146)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 添加可选参数 'count' 到 SetGroupAddRequest 以支持动态获取通知数量(#1113 补充) * feat: 设置 SetGroupAddRequest 中 'count' 的默认值为 100 * Update src/onebot/action/group/SetGroupAddRequest.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/onebot/action/group/SetGroupAddRequest.ts | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/onebot/action/group/SetGroupAddRequest.ts b/src/onebot/action/group/SetGroupAddRequest.ts index 8cd69bcd..bbf16aeb 100644 --- a/src/onebot/action/group/SetGroupAddRequest.ts +++ b/src/onebot/action/group/SetGroupAddRequest.ts @@ -1,5 +1,5 @@ import { OneBotAction } from '@/onebot/action/OneBotAction'; -import { NTGroupRequestOperateTypes } from '@/core/types'; +import { GroupNotify, NTGroupRequestOperateTypes } from '@/core/types'; import { ActionName } from '@/onebot/action/router'; import { Static, Type } from '@sinclair/typebox'; @@ -7,6 +7,7 @@ const SchemaData = Type.Object({ flag: Type.Union([Type.String(), Type.Number()]), approve: Type.Optional(Type.Union([Type.Boolean(), Type.String()])), reason: Type.Optional(Type.Union([Type.String({ default: ' ' }), Type.Null()])), + count: Type.Optional(Type.Number({ default: 100 })), }); type Payload = Static; @@ -19,8 +20,12 @@ export default class SetGroupAddRequest extends OneBotAction { const flag = payload.flag.toString(); const approve = payload.approve?.toString() !== 'false'; const reason = payload.reason ?? ' '; + const count = payload.count; const invite_notify = this.obContext.apis.MsgApi.notifyGroupInvite.get(flag); - const { doubt, notify } = invite_notify ? { doubt: false, notify: invite_notify } : await this.findNotify(flag); + const { doubt, notify } = invite_notify ? { + doubt: false, + notify: invite_notify, + } : await this.findNotify(flag, count); if (!notify) { throw new Error('No such request'); } @@ -33,12 +38,15 @@ export default class SetGroupAddRequest extends OneBotAction { return null; } - private async findNotify(flag: string) { - let notify = (await this.core.apis.GroupApi.getSingleScreenNotifies(false, 100)).find(e => e.seq == flag); + private async findNotify(flag: string, count: number = 100): Promise<{ + doubt: boolean, + notify: GroupNotify | undefined + }> { + let notify = (await this.core.apis.GroupApi.getSingleScreenNotifies(false, count)).find(e => e.seq == flag); if (!notify) { - notify = (await this.core.apis.GroupApi.getSingleScreenNotifies(true, 100)).find(e => e.seq == flag); + notify = (await this.core.apis.GroupApi.getSingleScreenNotifies(true, count)).find(e => e.seq == flag); return { doubt: true, notify }; } return { doubt: false, notify }; } -} \ No newline at end of file +}