feat: implement set qq profile
This commit is contained in:
1 parent
049ef2960c
commit
8b313fe088
6 files changed
+76
-2
No files matched your search
@@ -46,6 +46,7 @@ import {
|
||||
SsoReadedReportReqSchema,
|
||||
SetStatusReqSchema,
|
||||
SetStatusRespSchema,
|
||||
OidbSetProfileSchema,
|
||||
} from './proto/oidb-action';
|
||||
import { FileUploadExtSchema } from './proto/highway';
|
||||
import {
|
||||
@@ -1321,4 +1322,40 @@ export async function setOnlineStatus(
|
||||
throw new Error(resp.errMsg || `set online status failed with errCode: ${resp.errCode}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function setProfile(
|
||||
bridge: Bridge,
|
||||
nickname?: string,
|
||||
personalNote?: string
|
||||
): Promise<void> {
|
||||
const uin = BigInt(bridge.qqInfo.uin);
|
||||
const stringProfiles: any[] = [];
|
||||
const intProfiles: any[] = [];
|
||||
|
||||
if (nickname !== undefined) {
|
||||
stringProfiles.push({ fieldId: 20002, value: nickname });
|
||||
}
|
||||
|
||||
if (personalNote !== undefined) {
|
||||
stringProfiles.push({ fieldId: 102, value: personalNote });
|
||||
}
|
||||
|
||||
if (stringProfiles.length === 0 && intProfiles.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const req = {
|
||||
uin,
|
||||
stringProfiles,
|
||||
};
|
||||
|
||||
await sendOidbAndCheck(
|
||||
bridge,
|
||||
'OidbSvcTrpcTcp.0x112a_2',
|
||||
0x112A,
|
||||
2,
|
||||
req,
|
||||
OidbSetProfileSchema
|
||||
);
|
||||
}
|
||||
@@ -66,6 +66,7 @@ import {
|
||||
setFriendRemark as setFriendRemark_,
|
||||
fetchGroupFileCount as fetchGroupFileCount_,
|
||||
setOnlineStatus as setOnlineStatus_,
|
||||
setProfile as setProfile_,
|
||||
} from './bridge-actions';
|
||||
import {
|
||||
getGroupHonorInfo as getGroupHonorInfo_,
|
||||
@@ -492,6 +493,10 @@ export class Bridge {
|
||||
async setOnlineStatus(status: number, extStatus: number = 0, batteryStatus: number = 100): Promise<void> {
|
||||
return setOnlineStatus_(this, status, extStatus, batteryStatus);
|
||||
}
|
||||
async setProfile(nickname?: string, personalNote?: string): Promise<void> {
|
||||
return setProfile_(this, nickname, personalNote);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// --- Module-level helper functions ---
|
||||
|
||||
@@ -846,3 +846,20 @@ export const SetStatusRespSchema = {
|
||||
errCode: { field: 1, type: 'int32' as const }, // 盲猜字段 1 是错误码(虽然成功时没下发,默认 0)
|
||||
errMsg: { field: 2, type: 'string' as const }, // 返回的 "set status success"
|
||||
} satisfies ProtoSchema;
|
||||
|
||||
|
||||
export const OidbProfileStringItemSchema = {
|
||||
fieldId: { field: 1, type: 'uint32' as const },
|
||||
value: { field: 2, type: 'string' as const },
|
||||
} satisfies ProtoSchema;
|
||||
|
||||
export const OidbProfileIntItemSchema = {
|
||||
fieldId: { field: 1, type: 'uint32' as const },
|
||||
value: { field: 2, type: 'uint64' as const },
|
||||
} satisfies ProtoSchema;
|
||||
|
||||
export const OidbSetProfileSchema = {
|
||||
uin: { field: 1, type: 'uint64' as const },
|
||||
stringProfiles: { field: 2, type: 'repeated_message' as const, schema: OidbProfileStringItemSchema },
|
||||
intProfiles: { field: 3, type: 'repeated_message' as const, schema: OidbProfileIntItemSchema },
|
||||
} satisfies ProtoSchema;
|
||||
Reference in new issue
Block a user