mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-12 07:50:25 +00:00
refactor: Action
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
|
||||
@@ -13,7 +13,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class CreateCollection extends BaseAction<Payload, any> {
|
||||
export class CreateCollection extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.CreateCollection;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
|
||||
const SchemaData = {
|
||||
@@ -11,7 +11,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class FetchCustomFace extends BaseAction<Payload, string[]> {
|
||||
export class FetchCustomFace extends OneBotAction<Payload, string[]> {
|
||||
actionName = ActionName.FetchCustomFace;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//getMsgEmojiLikesList
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { MessageUnique } from '@/common/message-unique';
|
||||
|
||||
@@ -19,7 +19,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class FetchEmojiLike extends BaseAction<Payload, any> {
|
||||
export class FetchEmojiLike extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.FetchEmojiLike;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
|
||||
export class FetchUserProfileLike extends BaseAction<{ qq: number }, any> {
|
||||
export class FetchUserProfileLike extends OneBotAction<{ qq: number }, any> {
|
||||
actionName = ActionName.FetchUserProfileLike;
|
||||
|
||||
async _handle(payload: { qq: number }) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
|
||||
@@ -13,7 +13,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class GetCollectionList extends BaseAction<Payload, any> {
|
||||
export class GetCollectionList extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.GetCollectionList;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { OB11Entities } from '@/onebot/entities';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
|
||||
export class GetFriendWithCategory extends BaseAction<void, any> {
|
||||
export class GetFriendWithCategory extends OneBotAction<void, any> {
|
||||
actionName = ActionName.GetFriendsWithCategory;
|
||||
|
||||
async _handle(payload: void) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { GroupNotifyMsgStatus } from '@/core';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
|
||||
interface OB11GroupRequestNotify {
|
||||
@@ -8,7 +8,7 @@ interface OB11GroupRequestNotify {
|
||||
flag: string
|
||||
}
|
||||
|
||||
export default class GetGroupAddRequest extends BaseAction<null, OB11GroupRequestNotify[] | null> {
|
||||
export default class GetGroupAddRequest extends OneBotAction<null, OB11GroupRequestNotify[] | null> {
|
||||
actionName = ActionName.GetGroupIgnoreAddRequest;
|
||||
|
||||
async _handle(payload: null): Promise<OB11GroupRequestNotify[] | null> {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
|
||||
@@ -12,7 +12,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class GetGroupInfoEx extends BaseAction<Payload, any> {
|
||||
export class GetGroupInfoEx extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.GetGroupInfoEx;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
|
||||
interface Payload {
|
||||
@@ -6,7 +6,7 @@ interface Payload {
|
||||
count: number
|
||||
}
|
||||
|
||||
export class GetProfileLike extends BaseAction<Payload, any> {
|
||||
export class GetProfileLike extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.GetProfileLike;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
|
||||
export class GetRobotUinRange extends BaseAction<void, Array<any>> {
|
||||
export class GetRobotUinRange extends OneBotAction<void, Array<any>> {
|
||||
actionName = ActionName.GetRobotUinRange;
|
||||
|
||||
async _handle(payload: void) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
import { checkFileReceived, uri2local } from '@/common/file';
|
||||
@@ -14,7 +14,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class OCRImage extends BaseAction<Payload, any> {
|
||||
export class OCRImage extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.OCRImage;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { ChatType } from '@/core';
|
||||
|
||||
@@ -14,7 +14,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class SetInputStatus extends BaseAction<Payload, any> {
|
||||
export class SetInputStatus extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.SetInputStatus;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
|
||||
@@ -12,7 +12,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class SetLongNick extends BaseAction<Payload, any> {
|
||||
export class SetLongNick extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.SetLongNick;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
// 设置在线状态
|
||||
@@ -15,7 +15,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class SetOnlineStatus extends BaseAction<Payload, null> {
|
||||
export class SetOnlineStatus extends OneBotAction<Payload, null> {
|
||||
actionName = ActionName.SetOnlineStatus;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName, BaseCheckResult } from '../types';
|
||||
import * as fs from 'node:fs';
|
||||
import { checkFileReceived, uri2local } from '@/common/file';
|
||||
@@ -7,7 +7,7 @@ interface Payload {
|
||||
file: string;
|
||||
}
|
||||
|
||||
export default class SetAvatar extends BaseAction<Payload, null> {
|
||||
export default class SetAvatar extends OneBotAction<Payload, null> {
|
||||
actionName = ActionName.SetQQAvatar;
|
||||
|
||||
// 用不着复杂检测
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
|
||||
@@ -14,7 +14,7 @@ const SchemaData = {
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
|
||||
export class SharePeer extends BaseAction<Payload, any> {
|
||||
export class SharePeer extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.SharePeer;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
@@ -37,7 +37,7 @@ const SchemaDataGroupEx = {
|
||||
|
||||
type PayloadGroupEx = FromSchema<typeof SchemaDataGroupEx>;
|
||||
|
||||
export class ShareGroupEx extends BaseAction<PayloadGroupEx, any> {
|
||||
export class ShareGroupEx extends OneBotAction<PayloadGroupEx, any> {
|
||||
actionName = ActionName.ShareGroupEx;
|
||||
payloadSchema = SchemaDataGroupEx;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
|
||||
@@ -15,7 +15,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class TranslateEnWordToZn extends BaseAction<Payload, Array<any> | null> {
|
||||
export class TranslateEnWordToZn extends OneBotAction<Payload, Array<any> | null> {
|
||||
actionName = ActionName.TranslateEnWordToZn;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user