diff --git a/packages/onebot/src/actions/extended.ts b/packages/onebot/src/actions/extended.ts index 9705e2fd..3dcecadc 100644 --- a/packages/onebot/src/actions/extended.ts +++ b/packages/onebot/src/actions/extended.ts @@ -877,6 +877,23 @@ export const actions = [ }, }), + // get_recent_contact — 最近会话列表(占位)。QQ 原生该接口是内核本地快照 + // (getRecentContactListSnapShot),返回带 peerName/remark/lastestMsg 等丰富 + // 元信息;SnowLuma 既无对应 SSO/packet wire,自有 message store 也只覆盖 + // 「机器人观测到的会话」且缺这些字段,无法忠实复现。故诚实返回空表(而非 + // 用同名接口给出语义有偏差的近似),接受 count 入参以兼容客户端盲调。 + defineAction({ + name: 'get_recent_contact', + summary: '获取最近会话(占位)', + readOnly: true, + params: { + count: f.int({ min: 0 }).default(10), + }, + run: async () => { + return okResponse([]); + }, + }), + // get_online_clients — 在线设备列表。NapCat 也拿不到(注册监听后 sleep 500ms // 直接返回空),且其返回是裸数组 [],偏离 OneBot v11 / go-cqhttp 规范。 // SnowLuma 暂无对应单包 SSO cmd,返回 OneBot v11 标准空壳 { clients: [] } diff --git a/packages/onebot/tests/extended-actions.test.ts b/packages/onebot/tests/extended-actions.test.ts index c20ba2e6..b5b3a20b 100644 --- a/packages/onebot/tests/extended-actions.test.ts +++ b/packages/onebot/tests/extended-actions.test.ts @@ -864,3 +864,23 @@ describe('extended-actions / get_group_signed_list', () => { expect(res.status).toBe('failed'); }); }); + +// ─── TierB ②: get_recent_contact (documented stub) ─── +// QQ's recent-contact list is a kernel-local snapshot with rich peer +// metadata (peerName/remark/lastestMsg) that SnowLuma can't reproduce — +// there's no SSO/packet wire, and the bot's own message store only covers +// sessions it observed and lacks those fields. Rather than ship a +// divergent approximation under a name implying QQ's native list, we +// return an honest empty list and accept the `count` param for compat. +describe('extended-actions / get_recent_contact stub', () => { + it('returns an empty list and accepts count', async () => { + const res = await makeHandler(fakeCtx(fakeBridge())).handle('get_recent_contact', { count: 10 }); + expect(res).toMatchObject({ status: 'ok', retcode: 0 }); + expect(res.data).toEqual([]); + }); + + it('works with no params', async () => { + const res = await makeHandler(fakeCtx(fakeBridge())).handle('get_recent_contact', {}); + expect(res).toMatchObject({ status: 'ok', data: [] }); + }); +});