feat(onebot): configure group invite policy

Add validated group member invite policy updates with post-write verification.

Fixes #334
This commit is contained in:
DrSmoothl committed 2026-08-09 11:46:04 +08:00
1 parent 597a4c05f3
commit cd6fcadea4
11 files changed
+343 -6

No files matched your search

@@ -19,6 +19,7 @@ import { FetchGroupDetail } from '../../../src/oidb-services/contacts/fetch-grou
interface GroupDetailResultsFixture {
name?: pb<15, string>;
shutUpAllTimestamp?: pb<59, uint_32>;
privilegeFlag?: pb<99, uint_32>;
}
interface GroupDetailInfoFixture {
@@ -55,6 +56,7 @@ describe('FetchGroupDetail namespace', () => {
expect(out.config?.flags?.maxMemberCount).toBe(true);
expect((out.config?.flags as { shutUpAllTimestamp?: boolean })?.shutUpAllTimestamp)
.toBe(true);
expect(out.config?.flags?.privilegeFlag).toBe(true);
});
});
@@ -111,5 +113,27 @@ describe('FetchGroupDetail namespace', () => {
expect(out.groupInfo?.results?.shutUpAllTimestamp).toBe(4_294_967_295);
});
it('decodes the complete privilege flag used by masked group mutations', async () => {
const responseData = Buffer.from(protobuf_encode<OidbBase<GroupDetailResponseFixture>>({
body: {
groupInfo: {
uin: 601692726n,
results: { privilegeFlag: 0x82100001 },
},
},
}));
const sender = makeSender();
sender.sendRawPacket.mockResolvedValue({
success: true,
gotResponse: true,
errorCode: 0,
errorMessage: '',
responseData,
});
const out = await FetchGroupDetail.invoke(sender, { groupUin: 601692726 });
expect(out.groupInfo?.results?.privilegeFlag).toBe(0x82100001);
});
});
});