docs(onebot): document qidian flags on stranger info

Fill in the stranger-info action docs, catalog, and remaining profile
fixtures after the qidian flags landed. Ordinary accounts still
default to zero.

Refs #404
This commit is contained in:
DrSmoothl
2026-08-22 12:41:47 +08:00
parent 83f643f01b
commit 2bd2643670
10 changed files with 91 additions and 9 deletions
+13 -1
View File
@@ -7421,7 +7421,7 @@
"name": "get_stranger_info",
"aliases": [],
"summary": "获取陌生人信息",
"returns": "用户资料:QQ 号、昵称、好友备注、性别、年龄与个性签名,命中资料时另含等级。",
"returns": "用户资料:QQ 号、昵称、好友备注、性别、年龄与个性签名,命中资料时另含等级与企点标志。",
"returnsSchema": {
"type": "object",
"properties": {
@@ -7481,6 +7481,18 @@
"customStatusDescInfo": {
"type": "string",
"description": "自定义状态说明"
},
"qidian_master_flag": {
"type": "integer",
"description": "企点主号标志,0 或 1;普通账号为 0"
},
"qidian_crew_flag": {
"type": "integer",
"description": "企点员工标志,0 或 1;普通账号为 0"
},
"qidian_crew_flag_2": {
"type": "integer",
"description": "企点保留标志,0 或 1;普通账号为 0"
}
},
"required": [
+13 -1
View File
@@ -7424,7 +7424,7 @@ export const ACTIONS: CatalogAction[] = [
"name": "get_stranger_info",
"aliases": [],
"summary": "获取陌生人信息",
"returns": "用户资料:QQ 号、昵称、好友备注、性别、年龄与个性签名,命中资料时另含等级。",
"returns": "用户资料:QQ 号、昵称、好友备注、性别、年龄与个性签名,命中资料时另含等级与企点标志。",
"returnsSchema": {
"type": "object",
"properties": {
@@ -7484,6 +7484,18 @@ export const ACTIONS: CatalogAction[] = [
"customStatusDescInfo": {
"type": "string",
"description": "自定义状态说明"
},
"qidian_master_flag": {
"type": "integer",
"description": "企点主号标志,0 或 1;普通账号为 0"
},
"qidian_crew_flag": {
"type": "integer",
"description": "企点员工标志,0 或 1;普通账号为 0"
},
"qidian_crew_flag_2": {
"type": "integer",
"description": "企点保留标志,0 或 1;普通账号为 0"
}
},
"required": [
+4 -1
View File
@@ -32,7 +32,7 @@ export const actions = [
name: 'get_stranger_info',
summary: '获取陌生人信息',
readOnly: true,
returns: '用户资料:QQ 号、昵称、好友备注、性别、年龄与个性签名,命中资料时另含等级。',
returns: '用户资料:QQ 号、昵称、好友备注、性别、年龄与个性签名,命中资料时另含等级与企点标志。',
returnsSchema: {
type: 'object',
properties: {
@@ -50,6 +50,9 @@ export const actions = [
batteryStatus: { type: 'integer', description: '电量状态' },
customStatus: { type: 'object', description: '自定义状态', nullable: true },
customStatusDescInfo: { type: 'string', description: '自定义状态说明' },
qidian_master_flag: { type: 'integer', description: '企点主号标志,0 或 1;普通账号为 0' },
qidian_crew_flag: { type: 'integer', description: '企点员工标志,0 或 1;普通账号为 0' },
qidian_crew_flag_2: { type: 'integer', description: '企点保留标志,0 或 1;普通账号为 0' },
},
required: ['user_id', 'nickname', 'remark', 'sex', 'age', 'long_nick'],
},
@@ -296,9 +296,9 @@ function formatStrangerInfo(p: UserProfileInfo): JsonObject {
batteryStatus: p.batteryStatus ?? 0,
customStatus: p.customStatus ?? null,
customStatusDescInfo: p.customStatusDesc ?? '',
qidian_master_flag: p.qidianMasterFlag,
qidian_crew_flag: p.qidianCrewFlag,
qidian_crew_flag_2: p.qidianCrewFlag2,
qidian_master_flag: p.qidianMasterFlag ?? 0,
qidian_crew_flag: p.qidianCrewFlag ?? 0,
qidian_crew_flag_2: p.qidianCrewFlag2 ?? 0,
};
}
@@ -31,6 +31,9 @@ describe('get_stranger_info action', () => {
properties: {
remark: { type: 'string', description: '好友备注;非好友或未设置时为空字符串' },
long_nick: { type: 'string', description: '个性签名' },
qidian_master_flag: { type: 'integer' },
qidian_crew_flag: { type: 'integer' },
qidian_crew_flag_2: { type: 'integer' },
},
});
expect(schema?.required).toContain('remark');
@@ -817,6 +817,9 @@ describe('buildApiContext contact reads', () => {
batteryStatus: 0,
customStatus: null,
customStatusDescInfo: '',
qidian_master_flag: 0,
qidian_crew_flag: 0,
qidian_crew_flag_2: 0,
});
});
@@ -46,6 +46,41 @@ describe('FetchUserProfileByUid namespace (UID form)', () => {
const keys = env.body?.keys?.map(k => k.key);
expect(keys).toContain(20002); // nickname — the whole point
expect(keys).toContain(105); // QQ level
expect(keys).toContain(40410);
expect(keys).toContain(42031);
});
it('decodes qidian flags from number-properties (0 when absent)', async () => {
const qidian = makeSender({
body: {
uin: 3004251964, uid: 'u',
properties: {
bytesProperties: [],
numberProperties: [
{ number1: 40410, number2: 1 },
{ number1: 42031, number2: 1 },
],
},
} as any,
});
const out = await FetchUserProfileByUid.invoke(qidian, { uid: 'u' });
expect(out.qidianMasterFlag).toBe(1);
expect(out.qidianCrewFlag).toBe(1);
expect(out.qidianCrewFlag2).toBe(0);
const normal = makeSender({
body: {
uin: 10001, uid: 'u',
properties: {
bytesProperties: [],
numberProperties: [{ number1: 20009, number2: 1 }],
},
} as any,
});
const out2 = await FetchUserProfileByUid.invoke(normal, { uid: 'u' });
expect(out2.qidianMasterFlag).toBe(0);
expect(out2.qidianCrewFlag).toBe(0);
expect(out2.qidianCrewFlag2).toBe(0);
});
it('decodes nickname + uin from the response so the pipeline can fill them into the event', async () => {
@@ -16,7 +16,10 @@ afterEach(() => {
});
function makeProfile(uin: number, uid = ''): UserProfileInfo {
return { uin, uid, nickname: '', remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '', level: 0 };
return {
uin, uid, nickname: '', remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '', level: 0,
qidianMasterFlag: 0, qidianCrewFlag: 0, qidianCrewFlag2: 0,
};
}
function makeMember(uin: number, uid: string): GroupMemberInfo {
@@ -17,7 +17,10 @@ import type { GroupMemberInfo, QQGroupInfo, UserProfileInfo } from '@snowluma/pr
import type { PacketInfo } from '@snowluma/common/protocol-types';
function makeProfile(uin: number, uid = '', nickname = ''): UserProfileInfo {
return { uin, uid, nickname, remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '', level: 0 };
return {
uin, uid, nickname, remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '', level: 0,
qidianMasterFlag: 0, qidianCrewFlag: 0, qidianCrewFlag2: 0,
};
}
function makePipeline(opts: {
@@ -76,7 +76,11 @@ function msgPushContext(
function makePipeline(opts: {
fetchGroupList?: () => Promise<void>;
fetchGroupMemberList?: (groupId: number) => Promise<void>;
fetchProfileByUid?: () => Promise<{ uin: number; uid: string; nickname: string; remark: string; qid: string; sex: string; age: number; sign: string; avatar: string; level: number }>;
fetchProfileByUid?: () => Promise<{
uin: number; uid: string; nickname: string; remark: string; qid: string;
sex: string; age: number; sign: string; avatar: string; level: number;
qidianMasterFlag: number; qidianCrewFlag: number; qidianCrewFlag2: number;
}>;
} = {}) {
const identity = IdentityService.memory('10001');
if (opts.fetchProfileByUid) {
@@ -84,6 +88,7 @@ function makePipeline(opts: {
fetchProfile: async () => ({
uin: 0, uid: '', nickname: '', remark: '', qid: '', sex: 'unknown',
age: 0, sign: '', avatar: '', level: 0,
qidianMasterFlag: 0, qidianCrewFlag: 0, qidianCrewFlag2: 0,
}),
fetchProfileByUid: opts.fetchProfileByUid,
});
@@ -327,6 +332,9 @@ describe('IncomingPacketPipeline TRACE lifecycle', () => {
sign: '',
avatar: '',
level: 0,
qidianMasterFlag: 0,
qidianCrewFlag: 0,
qidianCrewFlag2: 0,
};
},
});