mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
Compare commits
4 Commits
d4fbbd6711
...
48b648b0fb
Author | SHA1 | Date | |
---|---|---|---|
![]() |
48b648b0fb | ||
![]() |
68e86b07c7 | ||
![]() |
12cb500818 | ||
![]() |
9ffaab178a |
@ -4,7 +4,7 @@
|
||||
"name": "NapCatQQ",
|
||||
"slug": "NapCat.Framework",
|
||||
"description": "高性能的 OneBot 11 协议实现",
|
||||
"version": "4.1.6",
|
||||
"version": "4.17",
|
||||
"icon": "./logo.png",
|
||||
"authors": [
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "napcat",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"version": "4.1.6",
|
||||
"version": "4.17",
|
||||
"scripts": {
|
||||
"build:framework": "npm run build:webui && vite build --mode framework",
|
||||
"build:shell": "npm run build:webui && vite build --mode shell",
|
||||
|
@ -1 +1 @@
|
||||
export const napCatVersion = '4.1.6';
|
||||
export const napCatVersion = '4.17';
|
||||
|
@ -1,32 +0,0 @@
|
||||
import { OB11Return } from '../types';
|
||||
|
||||
import { isNull } from '@/common/helper';
|
||||
|
||||
export class OB11Response {
|
||||
static res<T>(data: T, status: string, retcode: number, message: string = ''): OB11Return<T> {
|
||||
return {
|
||||
status: status,
|
||||
retcode: retcode,
|
||||
data: data,
|
||||
message: message,
|
||||
wording: message,
|
||||
echo: null,
|
||||
};
|
||||
}
|
||||
|
||||
static ok<T>(data: T, echo: any = null) {
|
||||
const res = OB11Response.res<T>(data, 'ok', 0);
|
||||
if (!isNull(echo)) {
|
||||
res.echo = echo;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static error(err: string, retcode: number, echo: any = null) {
|
||||
const res = OB11Response.res(null, 'failed', retcode, err);
|
||||
if (!isNull(echo)) {
|
||||
res.echo = echo;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
@ -1,15 +1,38 @@
|
||||
import { ActionName, BaseCheckResult } from './types';
|
||||
import { OB11Response } from './OB11Response';
|
||||
import { OB11Return } from '@/onebot/types';
|
||||
import Ajv, { ErrorObject, ValidateFunction } from 'ajv';
|
||||
import { NapCatCore } from '@/core';
|
||||
import { isNull } from '@/common/helper';
|
||||
import { NapCatOneBot11Adapter, OB11Return } from '@/onebot';
|
||||
|
||||
import { NapCatOneBot11Adapter } from '@/onebot';
|
||||
export class OB11Response {
|
||||
private static createResponse<T>(data: T, status: string, retcode: number, message: string = '', echo: any = null): OB11Return<T> {
|
||||
return {
|
||||
status,
|
||||
retcode,
|
||||
data,
|
||||
message,
|
||||
wording: message,
|
||||
echo,
|
||||
};
|
||||
}
|
||||
|
||||
abstract class BaseAction<PayloadType, ReturnDataType> {
|
||||
static res<T>(data: T, status: string, retcode: number, message: string = ''): OB11Return<T> {
|
||||
return this.createResponse(data, status, retcode, message);
|
||||
}
|
||||
|
||||
static ok<T>(data: T, echo: any = null): OB11Return<T> {
|
||||
return this.createResponse(data, 'ok', 0, '', echo);
|
||||
}
|
||||
|
||||
static error(err: string, retcode: number, echo: any = null): OB11Return<null> {
|
||||
return this.createResponse(null, 'failed', retcode, err, echo);
|
||||
}
|
||||
}
|
||||
|
||||
export abstract class OneBotAction<PayloadType, ReturnDataType> {
|
||||
actionName: ActionName = ActionName.Unknown;
|
||||
core: NapCatCore;
|
||||
private validate: undefined | ValidateFunction<any> = undefined;
|
||||
private validate: ValidateFunction<any> | undefined = undefined;
|
||||
payloadSchema: any = undefined;
|
||||
obContext: NapCatOneBot11Adapter;
|
||||
|
||||
@ -24,17 +47,13 @@ abstract class BaseAction<PayloadType, ReturnDataType> {
|
||||
}
|
||||
if (this.validate && !this.validate(payload)) {
|
||||
const errors = this.validate.errors as ErrorObject[];
|
||||
const errorMessages: string[] = errors.map((e) => {
|
||||
return `Key: ${e.instancePath.split('/').slice(1).join('.')}, Message: ${e.message}`;
|
||||
});
|
||||
const errorMessages = errors.map(e => `Key: ${e.instancePath.split('/').slice(1).join('.')}, Message: ${e.message}`);
|
||||
return {
|
||||
valid: false,
|
||||
message: errorMessages.join('\n') ?? '未知错误',
|
||||
};
|
||||
}
|
||||
return {
|
||||
valid: true,
|
||||
};
|
||||
return { valid: true };
|
||||
}
|
||||
|
||||
public async handle(payload: PayloadType, adaptername: string): Promise<OB11Return<ReturnDataType | null>> {
|
||||
@ -46,8 +65,8 @@ abstract class BaseAction<PayloadType, ReturnDataType> {
|
||||
const resData = await this._handle(payload, adaptername);
|
||||
return OB11Response.ok(resData);
|
||||
} catch (e: any) {
|
||||
this.core.context.logger.logError.bind(this.core.context.logger)('发生错误', e);
|
||||
return OB11Response.error(e?.stack?.toString() || e?.toString() || '未知错误,可能操作超时', 200);
|
||||
this.core.context.logger.logError('发生错误', e);
|
||||
return OB11Response.error(e?.toString() || e?.stack?.toString() || '未知错误,可能操作超时', 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,12 +79,10 @@ abstract class BaseAction<PayloadType, ReturnDataType> {
|
||||
const resData = await this._handle(payload, adaptername);
|
||||
return OB11Response.ok(resData, echo);
|
||||
} catch (e: any) {
|
||||
this.core.context.logger.logError.bind(this.core.context.logger)('发生错误', e);
|
||||
return OB11Response.error(e.stack?.toString() || e.toString(), 1200, echo);
|
||||
this.core.context.logger.logError('发生错误', e);
|
||||
return OB11Response.error(e.toString() || e.stack?.toString(), 1200, echo);
|
||||
}
|
||||
}
|
||||
|
||||
abstract _handle(payload: PayloadType, adaptername: string): PromiseLike<ReturnDataType>;
|
||||
}
|
||||
|
||||
export default BaseAction;
|
||||
}
|
@ -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;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import fs from 'fs/promises';
|
||||
import { FileNapCatOneBotUUID } from '@/common/helper';
|
||||
import { ActionName } from '../types';
|
||||
@ -30,7 +30,7 @@ const GetFileBase_PayloadSchema = {
|
||||
|
||||
export type GetFilePayload = FromSchema<typeof GetFileBase_PayloadSchema>;
|
||||
|
||||
export class GetFileBase extends BaseAction<GetFilePayload, GetFileResponse> {
|
||||
export class GetFileBase extends OneBotAction<GetFilePayload, GetFileResponse> {
|
||||
payloadSchema = GetFileBase_PayloadSchema;
|
||||
|
||||
async _handle(payload: GetFilePayload): Promise<GetFileResponse> {
|
||||
|
@ -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 = {
|
||||
@ -13,7 +13,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class CreateGroupFileFolder extends BaseAction<Payload, any> {
|
||||
export class CreateGroupFileFolder extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.GoCQHTTP_CreateGroupFileFolder;
|
||||
payloadSchema = SchemaData;
|
||||
async _handle(payload: Payload) {
|
||||
|
@ -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 { FileNapCatOneBotUUID } from '@/common/helper';
|
||||
|
||||
@ -14,7 +14,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class DeleteGroupFile extends BaseAction<Payload, any> {
|
||||
export class DeleteGroupFile extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.GOCQHTTP_DeleteGroupFile;
|
||||
payloadSchema = SchemaData;
|
||||
async _handle(payload: Payload) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
import { ActionName } from '../types';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
|
||||
const SchemaData = {
|
||||
type: 'object',
|
||||
@ -14,7 +14,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class DeleteGroupFileFolder extends BaseAction<Payload, any> {
|
||||
export class DeleteGroupFileFolder extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.GoCQHTTP_DeleteGroupFileFolder;
|
||||
payloadSchema = SchemaData;
|
||||
async _handle(payload: Payload) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import fs from 'fs';
|
||||
import { join as joinPath } from 'node:path';
|
||||
@ -28,7 +28,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class GoCQHTTPDownloadFile extends BaseAction<Payload, FileResponse> {
|
||||
export default class GoCQHTTPDownloadFile extends OneBotAction<Payload, FileResponse> {
|
||||
actionName = ActionName.GoCQHTTP_DownloadFile;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { OB11Message, OB11MessageData, OB11MessageDataType, OB11MessageForward, OB11MessageNodePlain as OB11MessageNode } from '@/onebot';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
@ -16,7 +16,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class GoCQHTTPGetForwardMsgAction extends BaseAction<Payload, any> {
|
||||
export class GoCQHTTPGetForwardMsgAction extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.GoCQHTTP_GetForwardMsg;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { OB11Message } from '@/onebot';
|
||||
import { ActionName } from '../types';
|
||||
import { ChatType } from '@/core/entities';
|
||||
@ -23,7 +23,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class GetFriendMsgHistory extends BaseAction<Payload, Response> {
|
||||
export default class GetFriendMsgHistory extends OneBotAction<Payload, Response> {
|
||||
actionName = ActionName.GetFriendMsgHistory;
|
||||
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';
|
||||
|
||||
@ -11,7 +11,7 @@ const SchemaData = {
|
||||
} as const satisfies JSONSchema;
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class GoCQHTTPGetGroupAtAllRemain extends BaseAction<Payload, any> {
|
||||
export class GoCQHTTPGetGroupAtAllRemain extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.GoCQHTTP_GetGroupAtAllRemain;
|
||||
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 = {
|
||||
@ -12,7 +12,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class GetGroupFileSystemInfo extends BaseAction<Payload, {
|
||||
export class GetGroupFileSystemInfo extends OneBotAction<Payload, {
|
||||
file_count: number,
|
||||
limit_count: number, // unimplemented
|
||||
used_space: number, // TODO:unimplemented, but can be implemented later
|
||||
|
@ -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 { OB11Entities } from '@/onebot/entities';
|
||||
|
||||
@ -16,7 +16,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class GetGroupFilesByFolder extends BaseAction<any, any> {
|
||||
export class GetGroupFilesByFolder extends OneBotAction<any, any> {
|
||||
actionName = ActionName.GoCQHTTP_GetGroupFilesByFolder;
|
||||
payloadSchema = SchemaData;
|
||||
async _handle(payload: Payload) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { WebHonorType } from '@/core/entities';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
@ -14,7 +14,7 @@ const SchemaData = {
|
||||
// enum是不是有点抽象
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class GetGroupHonorInfo extends BaseAction<Payload, Array<any>> {
|
||||
export class GetGroupHonorInfo extends OneBotAction<Payload, Array<any>> {
|
||||
actionName = ActionName.GetGroupHonorInfo;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { OB11Message } from '@/onebot';
|
||||
import { ActionName } from '../types';
|
||||
import { ChatType, Peer } from '@/core/entities';
|
||||
@ -23,7 +23,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class GoCQHTTPGetGroupMsgHistory extends BaseAction<Payload, Response> {
|
||||
export default class GoCQHTTPGetGroupMsgHistory extends OneBotAction<Payload, Response> {
|
||||
actionName = ActionName.GoCQHTTP_GetGroupMsgHistory;
|
||||
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 { OB11GroupFile, OB11GroupFileFolder } from '@/onebot';
|
||||
import { OB11Entities } from '@/onebot/entities';
|
||||
@ -15,7 +15,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class GetGroupRootFiles extends BaseAction<Payload, {
|
||||
export class GetGroupRootFiles extends OneBotAction<Payload, {
|
||||
files: OB11GroupFile[],
|
||||
folders: OB11GroupFileFolder[],
|
||||
}> {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { JSONSchema } from 'json-schema-to-ts';
|
||||
import { sleep } from '@/common/helper';
|
||||
@ -10,7 +10,7 @@ const SchemaData = {
|
||||
},
|
||||
} as const satisfies JSONSchema;
|
||||
|
||||
export class GetOnlineClient extends BaseAction<void, Array<any>> {
|
||||
export class GetOnlineClient extends OneBotAction<void, Array<any>> {
|
||||
actionName = ActionName.GetOnlineClient;
|
||||
|
||||
async _handle(payload: void) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { OB11User, OB11UserSex } from '@/onebot';
|
||||
import { OB11Entities } from '@/onebot/entities';
|
||||
import { ActionName } from '../types';
|
||||
@ -15,7 +15,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class GoCQHTTPGetStrangerInfo extends BaseAction<Payload, OB11User> {
|
||||
export default class GoCQHTTPGetStrangerInfo extends OneBotAction<Payload, OB11User> {
|
||||
actionName = ActionName.GoCQHTTP_GetStrangerInfo;
|
||||
|
||||
async _handle(payload: Payload): Promise<OB11User> {
|
||||
|
@ -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';
|
||||
|
||||
@ -11,7 +11,7 @@ const SchemaData = {
|
||||
} as const satisfies JSONSchema;
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class GoCQHTTPCheckUrlSafely extends BaseAction<Payload, any> {
|
||||
export class GoCQHTTPCheckUrlSafely extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.GoCQHTTP_CheckUrlSafely;
|
||||
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';
|
||||
|
||||
@ -18,7 +18,7 @@ const SchemaData = {
|
||||
} as const satisfies JSONSchema;
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class GoCQHTTPDeleteFriend extends BaseAction<Payload, any> {
|
||||
export class GoCQHTTPDeleteFriend extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.GoCQHTTP_DeleteFriend;
|
||||
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';
|
||||
|
||||
@ -10,7 +10,7 @@ const SchemaData = {
|
||||
} as const satisfies JSONSchema;
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class GoCQHTTPGetModelShow extends BaseAction<Payload, any> {
|
||||
export class GoCQHTTPGetModelShow extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.GoCQHTTP_GetModelShow;
|
||||
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';
|
||||
|
||||
@ -9,7 +9,7 @@ const SchemaData = {
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
//兼容性代码
|
||||
export class GoCQHTTPSetModelShow extends BaseAction<Payload, any> {
|
||||
export class GoCQHTTPSetModelShow extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.GoCQHTTP_SetModelShow;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { QuickAction, QuickActionEvent } from '@/onebot/types';
|
||||
|
||||
@ -7,7 +7,7 @@ interface Payload {
|
||||
operation: QuickAction
|
||||
}
|
||||
|
||||
export class GoCQHTTPHandleQuickAction extends BaseAction<Payload, null> {
|
||||
export class GoCQHTTPHandleQuickAction extends OneBotAction<Payload, null> {
|
||||
actionName = ActionName.GoCQHTTP_HandleQuickAction;
|
||||
|
||||
async _handle(payload: Payload): Promise<null> {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { checkFileReceived, uri2local } from '@/common/file';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { unlink } from 'node:fs';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
@ -21,7 +21,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class SendGroupNotice extends BaseAction<Payload, null> {
|
||||
export class SendGroupNotice extends OneBotAction<Payload, null> {
|
||||
actionName = ActionName.GoCQHTTP_SendGroupNotice;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
|
@ -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';
|
||||
@ -8,7 +8,7 @@ interface Payload {
|
||||
group_id: number
|
||||
}
|
||||
|
||||
export default class SetGroupPortrait extends BaseAction<Payload, any> {
|
||||
export default class SetGroupPortrait extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.SetGroupPortrait;
|
||||
|
||||
// 用不着复杂检测
|
||||
|
@ -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 SetQQProfile extends BaseAction<Payload, any> {
|
||||
export class SetQQProfile extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.SetQQProfile;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { ChatType, Peer } from '@/core/entities';
|
||||
import fs from 'fs';
|
||||
@ -20,7 +20,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class GoCQHTTPUploadGroupFile extends BaseAction<Payload, null> {
|
||||
export default class GoCQHTTPUploadGroupFile extends OneBotAction<Payload, null> {
|
||||
actionName = ActionName.GoCQHTTP_UploadGroupFile;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { ChatType, Peer, SendFileElement } from '@/core/entities';
|
||||
import fs from 'fs';
|
||||
@ -19,7 +19,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class GoCQHTTPUploadPrivateFile extends BaseAction<Payload, null> {
|
||||
export default class GoCQHTTPUploadPrivateFile extends OneBotAction<Payload, null> {
|
||||
actionName = ActionName.GOCQHTTP_UploadPrivateFile;
|
||||
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';
|
||||
import { MessageUnique } from '@/common/message-unique';
|
||||
@ -13,7 +13,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class DelEssenceMsg extends BaseAction<Payload, any> {
|
||||
export default class DelEssenceMsg extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.DelEssenceMsg;
|
||||
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';
|
||||
|
||||
@ -14,7 +14,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class DelGroupNotice extends BaseAction<Payload, any> {
|
||||
export class DelGroupNotice extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.DelGroupNotice;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ChatType, Peer } from '@/core';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
import { MessageUnique } from '@/common/message-unique';
|
||||
@ -16,7 +16,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class GetGroupEssence extends BaseAction<Payload, any> {
|
||||
export class GetGroupEssence extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.GoCQHTTP_GetEssenceMsg;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { GroupNotifyMsgStatus } from '@/core';
|
||||
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 GetGroupIgnoredNotifies extends BaseAction<void, any> {
|
||||
export class GetGroupIgnoredNotifies extends OneBotAction<void, any> {
|
||||
actionName = ActionName.GetGroupIgnoredNotifies;
|
||||
|
||||
async _handle(payload: void) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { OB11Group } from '@/onebot';
|
||||
import { OB11Entities } from '@/onebot/entities';
|
||||
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>;
|
||||
|
||||
class GetGroupInfo extends BaseAction<Payload, OB11Group> {
|
||||
class GetGroupInfo extends OneBotAction<Payload, OB11Group> {
|
||||
actionName = ActionName.GetGroupInfo;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { OB11Group } from '@/onebot';
|
||||
import { OB11Entities } from '@/onebot/entities';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
// no_cache get时传字符串
|
||||
@ -13,7 +13,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
class GetGroupList extends BaseAction<Payload, OB11Group[]> {
|
||||
class GetGroupList extends OneBotAction<Payload, OB11Group[]> {
|
||||
actionName = ActionName.GetGroupList;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { OB11GroupMember } from '@/onebot';
|
||||
import { OB11Entities } from '@/onebot/entities';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
|
||||
@ -16,7 +16,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
class GetGroupMemberInfo extends BaseAction<Payload, OB11GroupMember> {
|
||||
class GetGroupMemberInfo extends OneBotAction<Payload, OB11GroupMember> {
|
||||
actionName = ActionName.GetGroupMemberInfo;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { OB11GroupMember } from '@/onebot';
|
||||
import { OB11Entities } from '@/onebot/entities';
|
||||
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 GetGroupMemberList extends BaseAction<Payload, OB11GroupMember[]> {
|
||||
export class GetGroupMemberList extends OneBotAction<Payload, OB11GroupMember[]> {
|
||||
actionName = ActionName.GetGroupMemberList;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { WebApiGroupNoticeFeed } from '@/core';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
|
||||
@ -29,7 +29,7 @@ type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
type ApiGroupNotice = GroupNotice & WebApiGroupNoticeFeed;
|
||||
|
||||
export class GetGroupNotice extends BaseAction<Payload, GroupNotice[]> {
|
||||
export class GetGroupNotice extends OneBotAction<Payload, GroupNotice[]> {
|
||||
actionName = ActionName.GoCQHTTP_GetGroupNotice;
|
||||
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';
|
||||
|
||||
@ -12,7 +12,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class GetGroupShutList extends BaseAction<Payload, any> {
|
||||
export class GetGroupShutList extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.GetGroupShutList;
|
||||
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';
|
||||
import { MessageUnique } from '@/common/message-unique';
|
||||
@ -13,7 +13,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class SetEssenceMsg extends BaseAction<Payload, any> {
|
||||
export default class SetEssenceMsg extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.SetEssenceMsg;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { GroupRequestOperateTypes } from '@/core/entities';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
@ -15,7 +15,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class SetGroupAddRequest extends BaseAction<Payload, null> {
|
||||
export default class SetGroupAddRequest extends OneBotAction<Payload, null> {
|
||||
actionName = ActionName.SetGroupAddRequest;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { GroupMemberRole } from '@/core/entities';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
@ -15,7 +15,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class SetGroupAdmin extends BaseAction<Payload, null> {
|
||||
export default class SetGroupAdmin extends OneBotAction<Payload, null> {
|
||||
actionName = ActionName.SetGroupAdmin;
|
||||
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';
|
||||
|
||||
@ -14,7 +14,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class SetGroupBan extends BaseAction<Payload, null> {
|
||||
export default class SetGroupBan extends OneBotAction<Payload, null> {
|
||||
actionName = ActionName.SetGroupBan;
|
||||
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';
|
||||
|
||||
@ -14,7 +14,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class SetGroupCard extends BaseAction<Payload, null> {
|
||||
export default class SetGroupCard extends OneBotAction<Payload, null> {
|
||||
actionName = ActionName.SetGroupCard;
|
||||
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 default class SetGroupKick extends BaseAction<Payload, null> {
|
||||
export default class SetGroupKick extends OneBotAction<Payload, null> {
|
||||
actionName = ActionName.SetGroupKick;
|
||||
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';
|
||||
|
||||
@ -12,7 +12,7 @@ const SchemaData = {
|
||||
} as const satisfies JSONSchema;
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
export default class SetGroupLeave extends BaseAction<Payload, any> {
|
||||
export default class SetGroupLeave extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.SetGroupLeave;
|
||||
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 = {
|
||||
@ -12,7 +12,7 @@ const SchemaData = {
|
||||
} as const satisfies JSONSchema;
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
export default class SetGroupName extends BaseAction<Payload, null> {
|
||||
export default class SetGroupName extends OneBotAction<Payload, null> {
|
||||
actionName = ActionName.SetGroupName;
|
||||
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 = {
|
||||
@ -13,7 +13,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class SetGroupWholeBan extends BaseAction<Payload, null> {
|
||||
export default class SetGroupWholeBan extends OneBotAction<Payload, null> {
|
||||
actionName = ActionName.SetGroupWholeBan;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
|
||||
export default class GetGuildList extends BaseAction<null, null> {
|
||||
export default class GetGuildList extends OneBotAction<null, null> {
|
||||
actionName = ActionName.GetGuildList;
|
||||
|
||||
async _handle(payload: null): Promise<null> {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
|
||||
export default class GetGuildProfile extends BaseAction<null, null> {
|
||||
export default class GetGuildProfile extends OneBotAction<null, null> {
|
||||
actionName = ActionName.GetGuildProfile;
|
||||
|
||||
async _handle(payload: null): Promise<null> {
|
||||
|
@ -8,7 +8,7 @@ import SendGroupMsg from './group/SendGroupMsg';
|
||||
import SendPrivateMsg from './msg/SendPrivateMsg';
|
||||
import SendMsg from './msg/SendMsg';
|
||||
import DeleteMsg from './msg/DeleteMsg';
|
||||
import BaseAction from './BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import GetVersionInfo from './system/GetVersionInfo';
|
||||
import CanSendRecord from './system/CanSendRecord';
|
||||
import CanSendImage from './system/CanSendImage';
|
||||
@ -104,7 +104,7 @@ import { SendGroupAiRecord } from "@/onebot/action/group/SendGroupAiRecord";
|
||||
import { GetAiCharacters } from "@/onebot/action/extends/GetAiCharacters";
|
||||
|
||||
|
||||
export type ActionMap = Map<string, BaseAction<any, any>>;
|
||||
export type ActionMap = Map<string, OneBotAction<any, any>>;
|
||||
|
||||
export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCore): ActionMap {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ActionName } from '../types';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
import { MessageUnique } from '@/common/message-unique';
|
||||
|
||||
@ -18,7 +18,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
class DeleteMsg extends BaseAction<Payload, void> {
|
||||
class DeleteMsg extends OneBotAction<Payload, void> {
|
||||
actionName = ActionName.DeleteMsg;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ChatType, Peer } from '@/core/entities';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
@ -16,7 +16,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
class ForwardSingleMsg extends BaseAction<Payload, null> {
|
||||
class ForwardSingleMsg extends OneBotAction<Payload, null> {
|
||||
protected async getTargetPeer(payload: Payload): Promise<Peer> {
|
||||
if (payload.user_id) {
|
||||
const peerUid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { OB11Message } from '@/onebot';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
import { MessageUnique } from '@/common/message-unique';
|
||||
@ -19,7 +19,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
class GetMsg extends BaseAction<Payload, OB11Message> {
|
||||
class GetMsg extends OneBotAction<Payload, OB11Message> {
|
||||
actionName = ActionName.GetMsg;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { ChatType, Peer } from '@/core/entities';
|
||||
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';
|
||||
|
||||
@ -15,7 +15,7 @@ const SchemaData = {
|
||||
|
||||
type PlayloadType = FromSchema<typeof SchemaData>;
|
||||
|
||||
class MarkMsgAsRead extends BaseAction<PlayloadType, null> {
|
||||
class MarkMsgAsRead extends OneBotAction<PlayloadType, null> {
|
||||
async getPeer(payload: PlayloadType): Promise<Peer> {
|
||||
if (payload.message_id) {
|
||||
const s_peer = MessageUnique.getMsgIdAndPeerByShortId(+payload.message_id)?.Peer;
|
||||
@ -65,7 +65,7 @@ export class GoCQHTTPMarkMsgAsRead extends MarkMsgAsRead {
|
||||
actionName = ActionName.GoCQHTTP_MarkMsgAsRead;
|
||||
}
|
||||
|
||||
export class MarkAllMsgAsRead extends BaseAction<any, null> {
|
||||
export class MarkAllMsgAsRead extends OneBotAction<any, null> {
|
||||
actionName = ActionName._MarkAllMsgAsRead;
|
||||
|
||||
async _handle(): Promise<null> {
|
||||
|
@ -10,7 +10,7 @@ import { ActionName, BaseCheckResult } from '@/onebot/action/types';
|
||||
import { decodeCQCode } from '@/onebot/cqcode';
|
||||
import { MessageUnique } from '@/common/message-unique';
|
||||
import { ChatType, ElementType, NapCatCore, Peer, RawMessage, SendArkElement, SendMessageElement } from '@/core';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ForwardMsgBuilder } from "@/common/forward-msg-builder";
|
||||
import { stringifyWithBigInt } from "@/common/helper";
|
||||
import { PacketMsg } from "@/core/packet/message/message";
|
||||
@ -88,7 +88,7 @@ function getSpecialMsgNum(payload: OB11PostSendMsg, msgType: OB11MessageDataType
|
||||
return 0;
|
||||
}
|
||||
|
||||
export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
||||
export class SendMsg extends OneBotAction<OB11PostSendMsg, ReturnDataType> {
|
||||
actionName = ActionName.SendMsg;
|
||||
contextMode = ContextMode.Normal;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ActionName } from '../types';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
import { MessageUnique } from '@/common/message-unique';
|
||||
|
||||
@ -15,7 +15,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class SetMsgEmojiLike extends BaseAction<Payload, any> {
|
||||
export class SetMsgEmojiLike extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.SetMsgEmojiLike;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName, BaseCheckResult } from '../types';
|
||||
|
||||
|
||||
export abstract class GetPacketStatusDepends<PT, RT> extends BaseAction<PT, RT> {
|
||||
export abstract class GetPacketStatusDepends<PT, RT> extends OneBotAction<PT, RT> {
|
||||
actionName = ActionName.GetPacketStatus;
|
||||
|
||||
protected async check(payload: PT): Promise<BaseCheckResult>{
|
||||
|
@ -1,11 +1,11 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
|
||||
interface ReturnType {
|
||||
yes: boolean;
|
||||
}
|
||||
|
||||
export default class CanSendRecord extends BaseAction<any, ReturnType> {
|
||||
export default class CanSendRecord extends OneBotAction<any, ReturnType> {
|
||||
actionName = ActionName.CanSendRecord;
|
||||
|
||||
async _handle(_payload: void): Promise<ReturnType> {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
|
||||
export class GetCSRF extends BaseAction<any, any> {
|
||||
export class GetCSRF extends OneBotAction<any, any> {
|
||||
actionName = ActionName.GetCSRF;
|
||||
|
||||
async _handle(payload: any) {
|
||||
|
@ -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';
|
||||
|
||||
@ -17,7 +17,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class GetCredentials extends BaseAction<Payload, Response> {
|
||||
export class GetCredentials extends OneBotAction<Payload, Response> {
|
||||
actionName = ActionName.GetCredentials;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { OB11User } from '@/onebot';
|
||||
import { OB11Entities } from '@/onebot/entities';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
|
||||
class GetLoginInfo extends BaseAction<null, OB11User> {
|
||||
class GetLoginInfo extends OneBotAction<null, OB11User> {
|
||||
actionName = ActionName.GetLoginInfo;
|
||||
|
||||
async _handle(payload: null) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
|
||||
export default class GetStatus extends BaseAction<any, any> {
|
||||
export default class GetStatus extends OneBotAction<any, any> {
|
||||
actionName = ActionName.GetStatus;
|
||||
|
||||
async _handle(payload: any): Promise<any> {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { GroupNotifyMsgStatus } from '@/core';
|
||||
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 GetGroupSystemMsg extends BaseAction<void, any> {
|
||||
export class GetGroupSystemMsg extends OneBotAction<void, any> {
|
||||
actionName = ActionName.GetGroupSystemMsg;
|
||||
|
||||
async _handle(payload: void) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../types';
|
||||
|
||||
import { napCatVersion } from '@/common/version';
|
||||
|
||||
export default class GetVersionInfo extends BaseAction<any, any> {
|
||||
export default class GetVersionInfo extends OneBotAction<any, any> {
|
||||
actionName = ActionName.GetVersionInfo;
|
||||
|
||||
async _handle(payload: any): Promise<any> {
|
||||
|
@ -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';
|
||||
|
||||
@ -17,7 +17,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class GetCookies extends BaseAction<Payload, Response> {
|
||||
export class GetCookies extends OneBotAction<Payload, Response> {
|
||||
actionName = ActionName.GetCookies;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { OB11User } from '@/onebot';
|
||||
import { OB11Entities } from '@/onebot/entities';
|
||||
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 = {
|
||||
} as const satisfies JSONSchema;
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
export default class GetFriendList extends BaseAction<Payload, OB11User[]> {
|
||||
export default class GetFriendList extends OneBotAction<Payload, OB11User[]> {
|
||||
actionName = ActionName.GetFriendList;
|
||||
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 { AdapterConfigWrap } from '@/onebot/config/config';
|
||||
|
||||
@ -12,7 +12,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class GetRecentContact extends BaseAction<Payload, any> {
|
||||
export default class GetRecentContact extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.GetRecentContact;
|
||||
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';
|
||||
|
||||
@ -13,7 +13,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class SendLike extends BaseAction<Payload, null> {
|
||||
export default class SendLike extends OneBotAction<Payload, null> {
|
||||
actionName = ActionName.SendLike;
|
||||
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 = {
|
||||
@ -14,7 +14,7 @@ const SchemaData = {
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class SetFriendAddRequest extends BaseAction<Payload, null> {
|
||||
export default class SetFriendAddRequest extends OneBotAction<Payload, null> {
|
||||
actionName = ActionName.SetFriendAddRequest;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
|
@ -20,7 +20,7 @@ import {
|
||||
import faceConfig from '@/core/external/face_config.json';
|
||||
import { NapCatOneBot11Adapter, OB11Message, OB11MessageData, OB11MessageDataType, OB11MessageFileBase, } from '@/onebot';
|
||||
import { OB11Entities } from '@/onebot/entities';
|
||||
import { EventType } from '@/onebot/event/OB11BaseEvent';
|
||||
import { EventType } from '@/onebot/event/OneBotEvent';
|
||||
import { encodeCQCode } from '@/onebot/cqcode';
|
||||
import { uri2local } from '@/common/file';
|
||||
import { RequestUtil } from '@/common/request';
|
||||
|
@ -8,7 +8,7 @@ export enum EventType {
|
||||
MESSAGE_SENT = 'message_sent',
|
||||
}
|
||||
|
||||
export abstract class OB11BaseEvent {
|
||||
export abstract class OneBotEvent {
|
||||
time = Math.floor(Date.now() / 1000);
|
||||
self_id: number;
|
||||
abstract post_type: EventType;
|
@ -1,5 +1,5 @@
|
||||
import { EventType, OB11BaseEvent } from '../OB11BaseEvent';
|
||||
import { EventType, OneBotEvent } from '../OneBotEvent';
|
||||
|
||||
export abstract class OB11BaseMessageEvent extends OB11BaseEvent {
|
||||
export abstract class OB11BaseMessageEvent extends OneBotEvent {
|
||||
post_type = EventType.MESSAGE;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import { EventType, OB11BaseEvent } from '../OB11BaseEvent';
|
||||
import { EventType, OneBotEvent } from '@/onebot/event/OneBotEvent';
|
||||
|
||||
export abstract class OB11BaseMetaEvent extends OB11BaseEvent {
|
||||
export abstract class OB11BaseMetaEvent extends OneBotEvent {
|
||||
post_type = EventType.META;
|
||||
abstract meta_event_type: string;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { EventType, OB11BaseEvent } from '../OB11BaseEvent';
|
||||
import { EventType, OneBotEvent } from '@/onebot/event/OneBotEvent';
|
||||
|
||||
export abstract class OB11BaseNoticeEvent extends OB11BaseEvent {
|
||||
export abstract class OB11BaseNoticeEvent extends OneBotEvent {
|
||||
post_type = EventType.NOTICE;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
import { OB11BaseNoticeEvent } from '../notice/OB11BaseNoticeEvent';
|
||||
import { EventType } from '../OB11BaseEvent';
|
||||
import { EventType } from '../OneBotEvent';
|
||||
import { NapCatCore } from '@/core';
|
||||
|
||||
export class OB11FriendRequestEvent extends OB11BaseNoticeEvent {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { OB11GroupNoticeEvent } from '../notice/OB11GroupNoticeEvent';
|
||||
import { EventType } from '../OB11BaseEvent';
|
||||
import { EventType } from '../OneBotEvent';
|
||||
import { NapCatCore } from '@/core';
|
||||
|
||||
export class OB11GroupRequestEvent extends OB11GroupNoticeEvent {
|
||||
|
@ -577,15 +577,16 @@ export class NapCatOneBot11Adapter {
|
||||
private createMsgMap(network: Array<AdapterConfigWrap>, ob11Msg: any, isSelfMsg: boolean, message: RawMessage): Map<string, OB11Message> {
|
||||
const msgMap: Map<string, OB11Message> = new Map();
|
||||
network.filter(e => e.enable).forEach(e => {
|
||||
if (isSelfMsg) {
|
||||
ob11Msg.stringMsg.target_id = parseInt(message.peerUin);
|
||||
ob11Msg.arrayMsg.target_id = parseInt(message.peerUin);
|
||||
}
|
||||
if (e.messagePostFormat == 'string') {
|
||||
msgMap.set(e.name, structuredClone(ob11Msg.stringMsg));
|
||||
} else {
|
||||
msgMap.set(e.name, structuredClone(ob11Msg.arrayMsg));
|
||||
}
|
||||
if (isSelfMsg) {
|
||||
ob11Msg.stringMsg.target_id = parseInt(message.peerUin);
|
||||
ob11Msg.arrayMsg.target_id = parseInt(message.peerUin);
|
||||
}
|
||||
|
||||
});
|
||||
return msgMap;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import { WebSocket } from 'ws';
|
||||
import { OB11HeartbeatEvent } from '../event/meta/OB11HeartbeatEvent';
|
||||
import { NapCatCore } from '@/core';
|
||||
import { ActionName } from '@/onebot/action/types';
|
||||
import { OB11Response } from '@/onebot/action/OB11Response';
|
||||
import { OB11Response } from '@/onebot/action/OneBotAction';
|
||||
import { LogWrapper } from '@/common/log';
|
||||
import { ActionMap } from '@/onebot/action';
|
||||
import { LifeCycleSubType, OB11LifeCycleEvent } from '../event/meta/OB11LifeCycleEvent';
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { OB11BaseEvent } from '@/onebot/event/OB11BaseEvent';
|
||||
import { OneBotEvent } from '@/onebot/event/OneBotEvent';
|
||||
import { OB11Message } from '@/onebot';
|
||||
import { ActionMap } from '@/onebot/action';
|
||||
import { NetworkConfigAdapter } from '../config/config';
|
||||
|
||||
export type OB11EmitEventContent = OB11BaseEvent | OB11Message;
|
||||
export type OB11EmitEventContent = OneBotEvent | OB11Message;
|
||||
export enum OB11NetworkReloadType {
|
||||
Normal = 0,
|
||||
ConfigChange = 1,
|
||||
@ -16,7 +16,7 @@ export interface IOB11NetworkAdapter {
|
||||
name: string;
|
||||
isEnable: boolean;
|
||||
config: NetworkConfigAdapter;
|
||||
|
||||
|
||||
onEvent<T extends OB11EmitEventContent>(event: T): void;
|
||||
|
||||
open(): void | Promise<void>;
|
||||
|
@ -2,7 +2,7 @@ import { IOB11NetworkAdapter, OB11NetworkReloadType } from './index';
|
||||
import express, { Express, Request, Response } from 'express';
|
||||
import http from 'http';
|
||||
import { NapCatCore } from '@/core';
|
||||
import { OB11Response } from '../action/OB11Response';
|
||||
import { OB11Response } from '@/onebot/action/OneBotAction';
|
||||
import { ActionMap } from '@/onebot/action';
|
||||
import cors from 'cors';
|
||||
import { HttpServerConfig } from '../config/config';
|
||||
|
@ -2,7 +2,7 @@ import { IOB11NetworkAdapter, OB11EmitEventContent, OB11NetworkReloadType } from
|
||||
import urlParse from 'url';
|
||||
import { WebSocket, WebSocketServer } from 'ws';
|
||||
import { Mutex } from 'async-mutex';
|
||||
import { OB11Response } from '../action/OB11Response';
|
||||
import { OB11Response } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '../action/types';
|
||||
import { NapCatCore } from '@/core';
|
||||
import { LogWrapper } from '@/common/log';
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user