From 9ff82bdb9039adaa4f2c8a001764d0fe23b67aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Sun, 9 Jun 2024 18:28:09 +0800 Subject: [PATCH] feat: support SetLongNick --- src/onebot11/action/extends/SetLongNick.ts | 24 ++++++++++++++++++++++ src/onebot11/action/index.ts | 2 ++ src/onebot11/action/types.ts | 3 ++- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/onebot11/action/extends/SetLongNick.ts diff --git a/src/onebot11/action/extends/SetLongNick.ts b/src/onebot11/action/extends/SetLongNick.ts new file mode 100644 index 00000000..4e91fd24 --- /dev/null +++ b/src/onebot11/action/extends/SetLongNick.ts @@ -0,0 +1,24 @@ + +import BaseAction from '../BaseAction'; +import { ActionName } from '../types'; +import { NTQQUserApi } from '@/core/apis'; +import { FromSchema, JSONSchema } from 'json-schema-to-ts'; + +const SchemaData = { + type: 'object', + properties: { + longNick: { type: 'string' }, + }, + required: [ 'longNick'], +} as const satisfies JSONSchema; + +type Payload = FromSchema; + +export class SetLongNick extends BaseAction { + actionName = ActionName.SetSelfProfile; + PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { + let ret = await NTQQUserApi.setLongNick(payload.longNick) + return ret; + } +} diff --git a/src/onebot11/action/index.ts b/src/onebot11/action/index.ts index 85b91bd5..55181cf4 100644 --- a/src/onebot11/action/index.ts +++ b/src/onebot11/action/index.ts @@ -69,6 +69,7 @@ import { DelGroupFileFolder } from './file/DelGroupFileFolder'; import { SetSelfProfile } from './extends/SetSelfProfile'; import { shareGroupEx, sharePeer } from './extends/sharePeer'; import { CreateCollection } from './extends/CreateCollection'; +import { SetLongNick } from './extends/SetLongNick'; export const actionHandlers = [ new RebootNormal(), @@ -79,6 +80,7 @@ export const actionHandlers = [ new shareGroupEx(), new sharePeer(), new CreateCollection(), + new SetLongNick(), // new GetConfigAction(), // new SetConfigAction(), // new GetGroupAddRequest(), diff --git a/src/onebot11/action/types.ts b/src/onebot11/action/types.ts index 7eb37ac6..b53ad3ca 100644 --- a/src/onebot11/action/types.ts +++ b/src/onebot11/action/types.ts @@ -92,5 +92,6 @@ export enum ActionName { IOCRImage = '.ocr_image', SetSelfProfile = "set_self_profile", CreateCollection = "create_collection", - GetCollectionList = "get_collection_list" + GetCollectionList = "get_collection_list", + SetLongNick = "set_self_longnick" }