feat(onebot): TierB ② — get_recent_contact honest stub
QQ's recent-contact list is a kernel-local snapshot (getRecentContactListSnapShot) with rich peer metadata (peerName/remark/lastestMsg). SnowLuma has no SSO/packet wire for it, and its own message store only covers observed sessions and lacks those fields — so a faithful version isn't achievable app-layer. Rather than ship a divergent approximation under a name implying QQ's native list, register a documented stub returning [] (accepts count for compat), matching how NapCat handles its own unobtainable get_online_clients. The other ② stubs (online_clients/model_show/mark_all_as_read) were finalized in P1; collection stays in the deferred deep-RE tier.
This commit is contained in:
2 files changed
+37
No files matched your search
@@ -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: [] }
|
||||
|
||||
@@ -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: [] });
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user