lint
This commit is contained in:
977 files changed
+198426
-158324
No files matched your search
@@ -12,52 +12,52 @@
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type {
|
||||
CustomFaceModifyResp,
|
||||
CustomFaceMoveBody,
|
||||
CustomFaceModifyResp,
|
||||
CustomFaceMoveBody,
|
||||
} from '@snowluma/proto-defs/oidb-actions/base';
|
||||
import type { OidbBase } from '@snowluma/proto-defs/oidb';
|
||||
import { invokeOidb, type OidbSender } from '../../oidb-service';
|
||||
import { CLIENT_VERSION } from './shared';
|
||||
|
||||
export namespace MoveCustomFace {
|
||||
export const command = 0x902e;
|
||||
export const subCommand = 1;
|
||||
/** envelope reserved=1(UIN-form),抓包见信封 f12=1。不发则服务端不改顺序。 */
|
||||
export const uinForm = true;
|
||||
export const command = 0x902e;
|
||||
export const subCommand = 1;
|
||||
/** envelope reserved=1(UIN-form),抓包见信封 f12=1。不发则服务端不改顺序。 */
|
||||
export const uinForm = true;
|
||||
|
||||
export interface EmojiItem {
|
||||
/** 形如 `<UIN>_0_0_0_<MD5>_0_0`,来自 fetch 响应。 */
|
||||
emojiId: string;
|
||||
/** 32 位大写 hex MD5,emoji_id 中段。 */
|
||||
md5: string;
|
||||
}
|
||||
|
||||
export interface Params {
|
||||
/** 完整且有序的 emoji 列表,整表上传。 */
|
||||
emojis: EmojiItem[];
|
||||
}
|
||||
|
||||
export type Deps = OidbSender;
|
||||
|
||||
export const serialize = (_ctx: Deps, p: Params): CustomFaceMoveBody => ({
|
||||
field1: 1,
|
||||
osVersion: CLIENT_VERSION,
|
||||
opType: 2,
|
||||
emojis: p.emojis.map((e) => ({ emojiId: e.emojiId, md5: e.md5 })),
|
||||
});
|
||||
|
||||
export const deserialize = (_ctx: Deps, body: CustomFaceModifyResp): void => {
|
||||
if (body.retCode && body.retCode !== 0) {
|
||||
throw new Error(`move custom face error: ${body.errMsg || body.retCode}`);
|
||||
export interface EmojiItem {
|
||||
/** 形如 `<UIN>_0_0_0_<MD5>_0_0`,来自 fetch 响应。 */
|
||||
emojiId: string;
|
||||
/** 32 位大写 hex MD5,emoji_id 中段。 */
|
||||
md5: string;
|
||||
}
|
||||
};
|
||||
|
||||
export const encode = (env: OidbBase<CustomFaceMoveBody>): Uint8Array =>
|
||||
protobuf_encode<OidbBase<CustomFaceMoveBody>>(env);
|
||||
export interface Params {
|
||||
/** 完整且有序的 emoji 列表,整表上传。 */
|
||||
emojis: EmojiItem[];
|
||||
}
|
||||
|
||||
export const decode = (bytes: Uint8Array): OidbBase<CustomFaceModifyResp> =>
|
||||
protobuf_decode<OidbBase<CustomFaceModifyResp>>(bytes);
|
||||
export type Deps = OidbSender;
|
||||
|
||||
export const invoke = (deps: Deps, params: Params): Promise<void> =>
|
||||
invokeOidb(deps, MoveCustomFace, params);
|
||||
export const serialize = (_ctx: Deps, p: Params): CustomFaceMoveBody => ({
|
||||
field1: 1,
|
||||
osVersion: CLIENT_VERSION,
|
||||
opType: 2,
|
||||
emojis: p.emojis.map((e) => ({ emojiId: e.emojiId, md5: e.md5 })),
|
||||
});
|
||||
|
||||
export const deserialize = (_ctx: Deps, body: CustomFaceModifyResp): void => {
|
||||
if (body.retCode && body.retCode !== 0) {
|
||||
throw new Error(`move custom face error: ${body.errMsg || body.retCode}`);
|
||||
}
|
||||
};
|
||||
|
||||
export const encode = (env: OidbBase<CustomFaceMoveBody>): Uint8Array =>
|
||||
protobuf_encode<OidbBase<CustomFaceMoveBody>>(env);
|
||||
|
||||
export const decode = (bytes: Uint8Array): OidbBase<CustomFaceModifyResp> =>
|
||||
protobuf_decode<OidbBase<CustomFaceModifyResp>>(bytes);
|
||||
|
||||
export const invoke = (deps: Deps, params: Params): Promise<void> =>
|
||||
invokeOidb(deps, MoveCustomFace, params);
|
||||
}
|
||||
Reference in new issue
Block a user