feat(onebot): TierB ① — get_group_signed_list via qun.qq.com web API

Group sign-in (打卡) list is NapCat's one kernel-free item here: it's a
plain HTTP POST to qun.qq.com/v2/signin/trpc/GetDaySignedList with g_tk
from p_skey, not OIDB. SnowLuma already has the cookie/bkn infra (same as
group notice/essence/honor), so this is a straight port — no RE.

- protocol/web/group-signin.ts: getDaySignedListWebAPI + pure
  mapDaySignedList (de-skews signInRank via (r-1)/2+1, [] when no page).
- core WebApi.getSignedList(groupId) wires the qun.qq.com cookie jar.
- onebot get_group_signed_list groupAction (readOnly), [] on no sign-ins.
- Tests pin the rank/field transform and the action wiring.
This commit is contained in:
DrSmoothl committed 2026-06-18 19:24:42 +08:00
1 parent dfb6aa54c7
commit 36d557e5ea
6 files changed
+183

No files matched your search

@@ -842,3 +842,25 @@ describe('extended-actions / TierB compat stubs', () => {
expect(res).toMatchObject({ status: 'ok', retcode: 0 });
});
});
// ─── TierB ①: get_group_signed_list (qun.qq.com HTTP, real) ───
// Thin wrapper over WebApi.getSignedList; we pin that the action drives
// the web api with the numeric group id and passes the mapped list through.
describe('extended-actions / get_group_signed_list', () => {
it('calls web.getSignedList with the group id and returns the list', async () => {
const list = [{ user_id: 10001, nick: 'Alice', time: 1700000000, rank: 1 }];
const getSignedList = vi.fn(async () => list);
const bridge = fakeBridge({ apis: { web: { getSignedList } } });
const res = await makeHandler(fakeCtx(bridge)).handle('get_group_signed_list', { group_id: 12345 });
expect(getSignedList).toHaveBeenCalledWith(12345);
expect(res).toMatchObject({ status: 'ok', retcode: 0, data: list });
});
it('surfaces a failure as a failed response', async () => {
const getSignedList = vi.fn(async () => { throw new Error('no pskey'); });
const bridge = fakeBridge({ apis: { web: { getSignedList } } });
const res = await makeHandler(fakeCtx(bridge)).handle('get_group_signed_list', { group_id: 12345 });
expect(res.status).toBe('failed');
});
});