mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-30 21:49:04 +08:00
33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
|
||
import BaseAction from '../BaseAction';
|
||
import { ActionName } from '../types';
|
||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||
|
||
const SchemaData = {
|
||
type: 'object',
|
||
properties: {
|
||
nick: { type: 'string' },
|
||
longNick: { type: 'string' },
|
||
sex: { type: 'number' }//传Sex值?建议传0
|
||
},
|
||
required: ['nick', 'longNick', 'sex'],
|
||
} as const satisfies JSONSchema;
|
||
|
||
type Payload = FromSchema<typeof SchemaData>;
|
||
|
||
export class SetSelfProfile extends BaseAction<Payload, any | null> {
|
||
actionName = ActionName.SetSelfProfile;
|
||
PayloadSchema = SchemaData;
|
||
protected async _handle(payload: Payload) {
|
||
const NTQQUserApi = this.CoreContext.getApiContext().UserApi;
|
||
const ret = await NTQQUserApi.modifySelfProfile({
|
||
nick: payload.nick,
|
||
longNick: payload.longNick,
|
||
sex: payload.sex,
|
||
birthday: { birthday_year: '', birthday_month: '', birthday_day: '' },
|
||
location: undefined
|
||
});
|
||
return ret;
|
||
}
|
||
}
|