Compare commits

..

12 Commits

Author SHA1 Message Date
手瓜一十雪
648faedca6 fix: #544 2024-11-20 10:16:41 +08:00
Mlikiowa
3a6748ae37 release: v4.1.8
Some checks failed
Build Action / Build-LiteLoader (push) Failing after 13s
Build Action / Build-Shell (push) Failing after 3m22s
2024-11-19 10:45:26 +00:00
手瓜一十雪
4d4b1ad26c fix: #543 2024-11-19 18:44:56 +08:00
手瓜一十雪
e42fbea918 feat: 扩展rkey支持 2024-11-19 17:58:43 +08:00
Mlikiowa
48b648b0fb release: v4.17
Some checks failed
Build Action / Build-LiteLoader (push) Failing after 2m22s
Build Action / Build-Shell (push) Failing after 2m23s
2024-11-19 08:30:06 +00:00
手瓜一十雪
68e86b07c7 fix: #543 2024-11-19 16:29:33 +08:00
手瓜一十雪
12cb500818 refactor: rename OB11BaseEvent 2024-11-19 12:55:42 +08:00
手瓜一十雪
9ffaab178a refactor: Action 2024-11-19 12:49:51 +08:00
pk5ls20
d4fbbd6711 fix: #539
Some checks failed
Build Action / Build-LiteLoader (push) Failing after 2m33s
Build Action / Build-Shell (push) Failing after 2m17s
2024-11-19 01:12:49 +08:00
pk5ls20
ded53cd348 fix: link
Some checks failed
Build Action / Build-LiteLoader (push) Failing after 3m48s
Build Action / Build-Shell (push) Failing after 2m49s
2024-11-18 23:22:25 +08:00
手瓜一十雪
be9e80c87b fix: 清除无效链接 2024-11-18 20:40:43 +08:00
Mlikiowa
e9fe6f28cc release: v4.1.6 2024-11-18 11:51:39 +00:00
106 changed files with 317 additions and 315 deletions

View File

@@ -30,13 +30,11 @@ NapCatQQ 是现代化的基于 NTQQ 的 Bot 协议端实现
[Cloudflare.Pages](https://napneko.pages.dev/)
[Server.China](https://napneko.com/)
[Server.Other](https://napcat.cyou/)
## 回家旅途
[QQ Group](https://qm.qq.com/q/VfjAq5HIMS)
[QQ Group](https://qm.qq.com/q/haLGHixZ74)
## 感谢他们
感谢 [Lagrange](https://github.com/LagrangeDev/Lagrange.Core) 对本项目的大力支持 参考部分代码 已获授权

View File

@@ -4,7 +4,7 @@
"name": "NapCatQQ",
"slug": "NapCat.Framework",
"description": "高性能的 OneBot 11 协议实现",
"version": "4.1.5",
"version": "4.1.8",
"icon": "./logo.png",
"authors": [
{

View File

@@ -2,7 +2,7 @@
"name": "napcat",
"private": true,
"type": "module",
"version": "4.1.5",
"version": "4.1.8",
"scripts": {
"build:framework": "npm run build:webui && vite build --mode framework",
"build:shell": "npm run build:webui && vite build --mode shell",

View File

@@ -1 +1 @@
export const napCatVersion = '4.1.5';
export const napCatVersion = '4.1.8';

View File

@@ -36,7 +36,7 @@ export class NTQQFileApi {
constructor(context: InstanceContext, core: NapCatCore) {
this.context = context;
this.core = core;
this.rkeyManager = new RkeyManager(['https://llob.linyuchen.net/rkey', 'http://napcat-sign.wumiao.wang:2082/rkey'], this.context.logger);
this.rkeyManager = new RkeyManager(['https://rkey.napneko.icu/rkeys', 'https://llob.linyuchen.net/rkey', 'http://napcat-sign.wumiao.wang:2082/rkey'], this.context.logger);
}
async copyFile(filePath: string, destPath: string) {
@@ -107,7 +107,7 @@ export class NTQQFileApi {
};
}
async createValidSendPicElement(context: MessageContext, picPath: string, summary: string = '', subType: 0 | 1 = 0,): Promise<SendPicElement> {
async createValidSendPicElement(context: MessageContext, picPath: string, summary: string = '', subType: 0 | 1 = 0): Promise<SendPicElement> {
const { md5, fileName, path, fileSize } = await this.core.apis.FileApi.uploadFile(picPath, ElementType.PIC, subType);
if (fileSize === 0) {
throw new Error('文件异常大小为0');
@@ -300,18 +300,18 @@ export class NTQQFileApi {
element.elementType === ElementType.FILE
) {
switch (element.elementType) {
case ElementType.PIC:
case ElementType.PIC:
element.picElement!.sourcePath = elementResults[elementIndex];
break;
case ElementType.VIDEO:
break;
case ElementType.VIDEO:
element.videoElement!.filePath = elementResults[elementIndex];
break;
case ElementType.PTT:
break;
case ElementType.PTT:
element.pttElement!.filePath = elementResults[elementIndex];
break;
case ElementType.FILE:
break;
case ElementType.FILE:
element.fileElement!.filePath = elementResults[elementIndex];
break;
break;
}
elementIndex++;
}

View File

@@ -1,5 +1,5 @@
import { ChatType, GetFileListParam, Peer, RawMessage, SendMessageElement, SendStatusType } from '@/core/entities';
import { InstanceContext, NapCatCore } from '@/core';
import { GroupFileInfoUpdateItem, InstanceContext, NapCatCore } from '@/core';
import { GeneralCallResult } from '@/core/services/common';
export class NTQQMsgApi {
@@ -25,9 +25,11 @@ export class NTQQMsgApi {
async sendShowInputStatusReq(peer: Peer, eventType: number) {
return this.context.session.getMsgService().sendShowInputStatusReq(peer.chatType, eventType, peer.peerUid);
}
async getSourceOfReplyMsgV2(peer: Peer, clientSeq: string, time: string) {
return this.context.session.getMsgService().getSourceOfReplyMsgV2(peer, clientSeq, time);
}
async getMsgEmojiLikesList(peer: Peer, msgSeq: string, emojiId: string, emojiType: string, count: number = 20) {
//注意此处emojiType 可选值一般为1-2 2好像是unicode表情dec值 大部分情况 Taged Mlikiowa
return this.context.session.getMsgService().getMsgEmojiLikesList(peer, msgSeq, emojiId, emojiType, '', false, count);
@@ -111,7 +113,7 @@ export class NTQQMsgApi {
pageLimit: 1,
});
}
// 客户端还在用别慌
// 客户端还在用别慌
async getMsgsBySeqAndCount(peer: Peer, seq: string, count: number, desc: boolean, isReverseOrder: boolean) {
return await this.context.session.getMsgService().getMsgsBySeqAndCount(peer, seq, count, desc, isReverseOrder);
}
@@ -136,19 +138,29 @@ export class NTQQMsgApi {
}
async getGroupFileList(GroupCode: string, params: GetFileListParam) {
const [, groupFileListResult] = await this.core.eventWrapper.callNormalEventV2(
'NodeIKernelRichMediaService/getGroupFileList',
'NodeIKernelMsgListener/onGroupFileInfoUpdate',
[
GroupCode,
params,
],
() => true,
() => true, // 应当通过 groupFileListResult 判断
1,
5000,
);
return groupFileListResult.item;
const item: GroupFileInfoUpdateItem[] = [];
let index = params.startIndex;
while (true) {
params.startIndex = index;
const [, groupFileListResult] = await this.core.eventWrapper.callNormalEventV2(
'NodeIKernelRichMediaService/getGroupFileList',
'NodeIKernelMsgListener/onGroupFileInfoUpdate',
[
GroupCode,
params,
],
() => true,
() => true, // 应当通过 groupFileListResult 判断
1,
5000,
);
if (!groupFileListResult?.item?.length) break;
item.push(...groupFileListResult.item);
if (groupFileListResult.isEnd) break;
if (item.length === params.fileCount) break;
index = groupFileListResult.nextIndex;
}
return item;
}
async getMsgHistory(peer: Peer, msgId: string, count: number, isReverseOrder: boolean = false) {

View File

@@ -29,50 +29,10 @@ export interface GroupFileInfoUpdateParamType {
retMsg: string;
clientWording: string;
isEnd: boolean;
item: Array<{
peerId: string;
type: number;
folderInfo?: {
folderId: string;
parentFolderId: string;
folderName: string;
createTime: number;
modifyTime: number;
createUin: string;
creatorName: string;
totalFileCount: number;
modifyUin: string;
modifyName: string;
usedSpace: string;
},
fileInfo?: {
fileModelId: string;
fileId: string;
fileName: string;
fileSize: string;
busId: number;
uploadedSize: string;
uploadTime: number;
deadTime: number;
modifyTime: number;
downloadTimes: number;
sha: string;
sha3: string;
md5: string;
uploaderLocalPath: string;
uploaderName: string;
uploaderUin: string;
parentFolderId: string;
localPath: string;
transStatus: number;
transType: number;
elementId: string;
isFolder: boolean;
},
}>;
allFileCount: string;
nextIndex: string;
reqId: string;
item: Array<GroupFileInfoUpdateItem>;
allFileCount: number;
nextIndex: number;
reqId: number;
}
// {
@@ -83,6 +43,49 @@ export interface GroupFileInfoUpdateParamType {
// fromNick: '拾xxxx,
// sig: '0x'
// }
export interface GroupFileInfoUpdateItem {
peerId: string;
type: number;
folderInfo?: {
folderId: string;
parentFolderId: string;
folderName: string;
createTime: number;
modifyTime: number;
createUin: string;
creatorName: string;
totalFileCount: number;
modifyUin: string;
modifyName: string;
usedSpace: string;
},
fileInfo?: {
fileModelId: string;
fileId: string;
fileName: string;
fileSize: string;
busId: number;
uploadedSize: string;
uploadTime: number;
deadTime: number;
modifyTime: number;
downloadTimes: number;
sha: string;
sha3: string;
md5: string;
uploaderLocalPath: string;
uploaderName: string;
uploaderUin: string;
parentFolderId: string;
localPath: string;
transStatus: number;
transType: number;
elementId: string;
isFolder: boolean;
},
}
export interface TempOnRecvParams {
sessionType: number,//1
chatType: ChatType,//100

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 }) {

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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> {

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
// 用不着复杂检测

View File

@@ -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;

View File

@@ -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;

View File

@@ -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> {

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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[],
}> {

View File

@@ -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) {

View File

@@ -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> {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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> {

View File

@@ -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) {

View File

@@ -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;
// 用不着复杂检测

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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> {

View File

@@ -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> {

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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());

View File

@@ -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;

View File

@@ -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> {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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>{

View File

@@ -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> {

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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> {

View File

@@ -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) {

View File

@@ -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> {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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';

View File

@@ -149,6 +149,9 @@ export function mergeOneBotConfigs(
if (userConfig.musicSignUrl !== undefined) {
mergedConfig.musicSignUrl = userConfig.musicSignUrl;
}
if(userConfig.enableLocalFile2Url !== undefined) {
mergedConfig.enableLocalFile2Url = userConfig.enableLocalFile2Url;
}
return mergedConfig;
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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 {

View File

@@ -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 {

Some files were not shown because too many files have changed in this diff Show More