Compare commits

...

18 Commits

Author SHA1 Message Date
手瓜一十雪
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
手瓜一十雪
0b8bf739e9 fix: event 2024-11-18 19:51:08 +08:00
手瓜一十雪
0222664db8 fix: type
Some checks failed
Build Action / Build-LiteLoader (push) Failing after 14m48s
Build Action / Build-Shell (push) Failing after 14m43s
2024-11-17 16:02:25 +08:00
手瓜一十雪
a88792e452 docs: 没有参考故移除 2024-11-17 16:01:44 +08:00
手瓜一十雪
ad45400742 docs: 调整更新速度与Packet重构 2024-11-17 15:57:21 +08:00
手瓜一十雪
53e5ba03be fix 2024-11-17 15:56:48 +08:00
手瓜一十雪
b587d6b91d fix: (SetGroupSign) BaseAction-->GetPacketStatusDepends 2024-11-17 15:37:10 +08:00
手瓜一十雪
5e750d4ee9 feat: uploadQunAlbum未测试
Some checks failed
Build Action / Build-LiteLoader (push) Failing after 2m40s
Build Action / Build-Shell (push) Failing after 2m38s
2024-11-17 13:39:57 +08:00
Mlikiowa
50fb32f81c release: v4.1.5 2024-11-17 03:39:17 +00:00
109 changed files with 464 additions and 340 deletions

View File

@@ -8,7 +8,7 @@
## 欢迎回家 ## 欢迎回家
NapCatQQ 是现代化的基于 NTQQ 的 Bot 协议端实现 NapCatQQ 是现代化的基于 NTQQ 的 Bot 协议端实现
## 碎碎叨叨 ## 特性介绍
- [x] **安装简单**:就算是笨蛋也能使用 - [x] **安装简单**:就算是笨蛋也能使用
- [x] **性能友好**:就算是低内存也能使用 - [x] **性能友好**:就算是低内存也能使用
- [x] **接口丰富**:就算是没有也能使用 - [x] **接口丰富**:就算是没有也能使用
@@ -26,19 +26,17 @@ NapCatQQ 是现代化的基于 NTQQ 的 Bot 协议端实现
[Cloudflare.HKServer](https://napcat.napneko.icu/) [Cloudflare.HKServer](https://napcat.napneko.icu/)
[Cloudflare.Pages](https://napneko.pages.dev/) [Github.IO](https://napneko.github.io/)
[Server.China](https://napneko.com/) [Cloudflare.Pages](https://napneko.pages.dev/)
[Server.Other](https://napcat.cyou/) [Server.Other](https://napcat.cyou/)
[Github.IO](https://napneko.github.io/)
## 回家旅途 ## 回家旅途
[QQ Group](https://qm.qq.com/q/VfjAq5HIMS) [QQ Group](https://qm.qq.com/q/haLGHixZ74)
## 感谢他们 ## 感谢他们
感谢 [LLOneBot](https://github.com/LLOneBot/LLOneBot)
感谢 [Lagrange](https://github.com/LagrangeDev/Lagrange.Core) 对本项目的大力支持 参考部分代码 已获授权 感谢 [Lagrange](https://github.com/LagrangeDev/Lagrange.Core) 对本项目的大力支持 参考部分代码 已获授权
感谢 Tencent Tdesign / Vue3 强力驱动 NapCat.WebUi 感谢 Tencent Tdesign / Vue3 强力驱动 NapCat.WebUi
@@ -46,6 +44,14 @@ NapCatQQ 是现代化的基于 NTQQ 的 Bot 协议端实现
不过最最重要的 还是需要感谢屏幕前的你哦~ 不过最最重要的 还是需要感谢屏幕前的你哦~
--- ---
## 延缓Native模块与NapCat对新版QQ适配
为未来持续与高效的使用Native模块 模块代码转为完全非Git仓库的本地保存源码 并进行相关重构
同时为了保证稳定 NapCat 本体通常会在3 Week+的周期进行新版本适配
因此此时推荐使用release指定版本
## 开源附加 ## 开源附加
任何使用本仓库代码的地方,都应当严格遵守[本仓库开源许可](./LICENSE)。**此外,禁止任何项目未经仓库主作者授权二次分发或基于 NapCat 代码开发。** 任何使用本仓库代码的地方,都应当严格遵守[本仓库开源许可](./LICENSE)。**此外,禁止任何项目未经仓库主作者授权二次分发或基于 NapCat 代码开发。**

View File

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

View File

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

View File

@@ -234,25 +234,33 @@ export class NTEventWrapper {
this.EventTask.get(ListenerMainName)?.get(ListenerSubName)?.set(id, eventCallback); this.EventTask.get(ListenerMainName)?.get(ListenerSubName)?.set(id, eventCallback);
this.createListenerFunction(ListenerMainName); this.createListenerFunction(ListenerMainName);
this.createEventFunction(serviceAndMethod)!(...(args)) let eventResult = this.createEventFunction(serviceAndMethod)!(...(args));
.then((eventResult: any) => {
retEvent = eventResult; const eventRetHandle = (eventData: any) => {
if (!checkerEvent(retEvent) && timeoutRef.hasRef()) { retEvent = eventData;
clearTimeout(timeoutRef); if (!checkerEvent(retEvent) && timeoutRef.hasRef()) {
reject( clearTimeout(timeoutRef);
new Error( reject(
'EventChecker Failed: NTEvent serviceAndMethod:' + new Error(
serviceAndMethod + 'EventChecker Failed: NTEvent serviceAndMethod:' +
' ListenerName:' + serviceAndMethod +
listenerAndMethod + ' ListenerName:' +
' EventRet:\n' + listenerAndMethod +
JSON.stringify(retEvent, null, 4) + ' EventRet:\n' +
'\n', JSON.stringify(retEvent, null, 4) +
), '\n',
); ),
} );
}
}
if (eventResult instanceof Promise) {
eventResult.then((eventResult: any) => {
eventRetHandle(eventResult);
}) })
.catch(reject); .catch(reject);
} else {
eventRetHandle(eventResult);
}
}, },
); );
} }

View File

@@ -1 +1 @@
export const napCatVersion = '4.1.3'; export const napCatVersion = '4.17';

View File

@@ -36,7 +36,7 @@ export class NTQQFileApi {
constructor(context: InstanceContext, core: NapCatCore) { constructor(context: InstanceContext, core: NapCatCore) {
this.context = context; this.context = context;
this.core = core; 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) { async copyFile(filePath: string, destPath: string) {
@@ -300,18 +300,18 @@ export class NTQQFileApi {
element.elementType === ElementType.FILE element.elementType === ElementType.FILE
) { ) {
switch (element.elementType) { switch (element.elementType) {
case ElementType.PIC: case ElementType.PIC:
element.picElement!.sourcePath = elementResults[elementIndex]; element.picElement!.sourcePath = elementResults[elementIndex];
break; break;
case ElementType.VIDEO: case ElementType.VIDEO:
element.videoElement!.filePath = elementResults[elementIndex]; element.videoElement!.filePath = elementResults[elementIndex];
break; break;
case ElementType.PTT: case ElementType.PTT:
element.pttElement!.filePath = elementResults[elementIndex]; element.pttElement!.filePath = elementResults[elementIndex];
break; break;
case ElementType.FILE: case ElementType.FILE:
element.fileElement!.filePath = elementResults[elementIndex]; element.fileElement!.filePath = elementResults[elementIndex];
break; break;
} }
elementIndex++; elementIndex++;
} }

View File

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

View File

@@ -8,6 +8,9 @@ import {
WebHonorType, WebHonorType,
} from '@/core'; } from '@/core';
import { NapCatCore } from '..'; import { NapCatCore } from '..';
import { createReadStream, readFileSync, statSync } from 'node:fs';
import { createHash } from 'node:crypto';
import { basename } from 'node:path';
export class NTQQWebApi { export class NTQQWebApi {
context: InstanceContext; context: InstanceContext;
@@ -303,4 +306,110 @@ export class NTQQWebApi {
} }
return (hash & 0x7FFFFFFF).toString(); return (hash & 0x7FFFFFFF).toString();
} }
async createQunAlbumSession(gc: string, sAlbumID: string, sAlbumName: string, path: string, skey: string, pskey: string, uin: string) {
const img = readFileSync(path);
const img_md5 = createHash('md5').update(img).digest('hex');
const img_size = img.length;
const img_name = basename(path);
const time = Math.floor(Date.now() / 1000);
const GTK = this.getBknFromSKey(pskey);
const cookie = `p_uin=${uin}; p_skey=${pskey}; skey=${skey}; uin=${uin}`;
const body = {
control_req: [{
uin: uin,
token: {
type: 4,
data: pskey,
appid: 5
},
appid: "qun",
checksum: img_md5,
check_type: 0,
file_len: img_size,
env: {
refer: "qzone",
deviceInfo: "h5"
},
model: 0,
biz_req: {
sPicTitle: img_name,
sPicDesc: "",
sAlbumName: sAlbumName,
sAlbumID: sAlbumID,
iAlbumTypeID: 0,
iBitmap: 0,
iUploadType: 0,
iUpPicType: 0,
iBatchID: time,
sPicPath: "",
iPicWidth: 0,
iPicHight: 0,
iWaterType: 0,
iDistinctUse: 0,
iNeedFeeds: 1,
iUploadTime: time,
mapExt: {
appid: "qun",
userid: gc
}
},
session: "",
asy_upload: 0,
cmd: "FileUpload"
}]
};
const api = `https://h5.qzone.qq.com/webapp/json/sliceUpload/FileBatchControl/${img_md5}?g_tk=${GTK}`;
const post = await RequestUtil.HttpGetJson(api, 'POST', body, {
"Cookie": cookie,
"Content-Type": "application/json"
});
return post;
}
async uploadQunAlbumSlice(path: string, session: string, skey: string, pskey: string, uin: string, slice_size: number) {
const img_size = statSync(path).size;
const img_name = basename(path);
let seq = 0;
let offset = 0;
const GTK = this.getBknFromSKey(pskey);
const cookie = `p_uin=${uin}; p_skey=${pskey}; skey=${skey}; uin=${uin}`;
const stream = createReadStream(path, { highWaterMark: slice_size });
for await (const chunk of stream) {
const end = Math.min(offset + chunk.length, img_size);
const boundary = `----WebKitFormBoundary${Math.random().toString(36).substring(2)}`;
const formData = await RequestUtil.createFormData(boundary, path);
const api = `https://h5.qzone.qq.com/webapp/json/sliceUpload/FileUpload?seq=${seq}&retry=0&offset=${offset}&end=${end}&total=${img_size}&type=form&g_tk=${GTK}`;
const body = {
uin: uin,
appid: "qun",
session: session,
offset: offset,
data: formData,
checksum: "",
check_type: 0,
retry: 0,
seq: seq,
end: end,
cmd: "FileUpload",
slice_size: slice_size,
"biz_req.iUploadType": 0
};
const post = await RequestUtil.HttpGetJson(api, 'POST', body, {
"Cookie": cookie,
"Content-Type": `multipart/form-data; boundary=${boundary}`
});
offset += chunk.length;
seq++;
}
}
async uploadQunAlbum(path: string, albumId: string, group: string, skey: string, pskey: string, uin: string) {
const session = (await this.createQunAlbumSession(group, albumId, group, path, skey, pskey, uin) as { data: { session: string } }).data.session;
return await this.uploadQunAlbumSlice(path, session, skey, pskey, uin, 1024 * 1024);
}
} }

View File

@@ -29,50 +29,10 @@ export interface GroupFileInfoUpdateParamType {
retMsg: string; retMsg: string;
clientWording: string; clientWording: string;
isEnd: boolean; isEnd: boolean;
item: Array<{ item: Array<GroupFileInfoUpdateItem>;
peerId: string; allFileCount: number;
type: number; nextIndex: number;
folderInfo?: { reqId: number;
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;
} }
// { // {
@@ -83,6 +43,49 @@ export interface GroupFileInfoUpdateParamType {
// fromNick: '拾xxxx, // fromNick: '拾xxxx,
// sig: '0x' // 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 { export interface TempOnRecvParams {
sessionType: number,//1 sessionType: number,//1
chatType: ChatType,//100 chatType: ChatType,//100

View File

@@ -150,7 +150,7 @@ export interface NodeIQQNTWrapperSession {
nodeIKernelSessionListener: NodeIKernelSessionListener, nodeIKernelSessionListener: NodeIKernelSessionListener,
): void; ): void;
startNT(n: 0): void; startNT(session: number): void;
startNT(): void; startNT(): void;

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 { ActionName, BaseCheckResult } from './types';
import { OB11Response } from './OB11Response';
import { OB11Return } from '@/onebot/types';
import Ajv, { ErrorObject, ValidateFunction } from 'ajv'; import Ajv, { ErrorObject, ValidateFunction } from 'ajv';
import { NapCatCore } from '@/core'; 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; actionName: ActionName = ActionName.Unknown;
core: NapCatCore; core: NapCatCore;
private validate: undefined | ValidateFunction<any> = undefined; private validate: ValidateFunction<any> | undefined = undefined;
payloadSchema: any = undefined; payloadSchema: any = undefined;
obContext: NapCatOneBot11Adapter; obContext: NapCatOneBot11Adapter;
@@ -24,17 +47,13 @@ abstract class BaseAction<PayloadType, ReturnDataType> {
} }
if (this.validate && !this.validate(payload)) { if (this.validate && !this.validate(payload)) {
const errors = this.validate.errors as ErrorObject[]; const errors = this.validate.errors as ErrorObject[];
const errorMessages: string[] = errors.map((e) => { const errorMessages = errors.map(e => `Key: ${e.instancePath.split('/').slice(1).join('.')}, Message: ${e.message}`);
return `Key: ${e.instancePath.split('/').slice(1).join('.')}, Message: ${e.message}`;
});
return { return {
valid: false, valid: false,
message: errorMessages.join('\n') ?? '未知错误', message: errorMessages.join('\n') ?? '未知错误',
}; };
} }
return { return { valid: true };
valid: true,
};
} }
public async handle(payload: PayloadType, adaptername: string): Promise<OB11Return<ReturnDataType | null>> { 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); const resData = await this._handle(payload, adaptername);
return OB11Response.ok(resData); return OB11Response.ok(resData);
} catch (e: any) { } catch (e: any) {
this.core.context.logger.logError.bind(this.core.context.logger)('发生错误', e); this.core.context.logger.logError('发生错误', e);
return OB11Response.error(e?.stack?.toString() || e?.toString() || '未知错误,可能操作超时', 200); 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); const resData = await this._handle(payload, adaptername);
return OB11Response.ok(resData, echo); return OB11Response.ok(resData, echo);
} catch (e: any) { } catch (e: any) {
this.core.context.logger.logError.bind(this.core.context.logger)('发生错误', e); this.core.context.logger.logError('发生错误', e);
return OB11Response.error(e.stack?.toString() || e.toString(), 1200, echo); return OB11Response.error(e.toString() || e.stack?.toString(), 1200, echo);
} }
} }
abstract _handle(payload: PayloadType, adaptername: string): PromiseLike<ReturnDataType>; 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 { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -13,7 +13,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class CreateCollection extends BaseAction<Payload, any> { export class CreateCollection extends OneBotAction<Payload, any> {
actionName = ActionName.CreateCollection; actionName = ActionName.CreateCollection;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,5 +1,5 @@
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
const SchemaData = { const SchemaData = {
@@ -11,7 +11,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class FetchCustomFace extends BaseAction<Payload, string[]> { export class FetchCustomFace extends OneBotAction<Payload, string[]> {
actionName = ActionName.FetchCustomFace; actionName = ActionName.FetchCustomFace;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,6 +1,6 @@
//getMsgEmojiLikesList //getMsgEmojiLikesList
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { MessageUnique } from '@/common/message-unique'; import { MessageUnique } from '@/common/message-unique';
@@ -19,7 +19,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class FetchEmojiLike extends BaseAction<Payload, any> { export class FetchEmojiLike extends OneBotAction<Payload, any> {
actionName = ActionName.FetchEmojiLike; actionName = ActionName.FetchEmojiLike;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,7 +1,7 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
export class FetchUserProfileLike extends BaseAction<{ qq: number }, any> { export class FetchUserProfileLike extends OneBotAction<{ qq: number }, any> {
actionName = ActionName.FetchUserProfileLike; actionName = ActionName.FetchUserProfileLike;
async _handle(payload: { qq: number }) { 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 { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -13,7 +13,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class GetCollectionList extends BaseAction<Payload, any> { export class GetCollectionList extends OneBotAction<Payload, any> {
actionName = ActionName.GetCollectionList; actionName = ActionName.GetCollectionList;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,8 +1,8 @@
import { OB11Entities } from '@/onebot/entities'; import { OB11Entities } from '@/onebot/entities';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
export class GetFriendWithCategory extends BaseAction<void, any> { export class GetFriendWithCategory extends OneBotAction<void, any> {
actionName = ActionName.GetFriendsWithCategory; actionName = ActionName.GetFriendsWithCategory;
async _handle(payload: void) { async _handle(payload: void) {

View File

@@ -1,5 +1,5 @@
import { GroupNotifyMsgStatus } from '@/core'; import { GroupNotifyMsgStatus } from '@/core';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
interface OB11GroupRequestNotify { interface OB11GroupRequestNotify {
@@ -8,7 +8,7 @@ interface OB11GroupRequestNotify {
flag: string flag: string
} }
export default class GetGroupAddRequest extends BaseAction<null, OB11GroupRequestNotify[] | null> { export default class GetGroupAddRequest extends OneBotAction<null, OB11GroupRequestNotify[] | null> {
actionName = ActionName.GetGroupIgnoreAddRequest; actionName = ActionName.GetGroupIgnoreAddRequest;
async _handle(payload: null): Promise<OB11GroupRequestNotify[] | null> { 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 { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -12,7 +12,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class GetGroupInfoEx extends BaseAction<Payload, any> { export class GetGroupInfoEx extends OneBotAction<Payload, any> {
actionName = ActionName.GetGroupInfoEx; actionName = ActionName.GetGroupInfoEx;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
interface Payload { interface Payload {
@@ -6,7 +6,7 @@ interface Payload {
count: number count: number
} }
export class GetProfileLike extends BaseAction<Payload, any> { export class GetProfileLike extends OneBotAction<Payload, any> {
actionName = ActionName.GetProfileLike; actionName = ActionName.GetProfileLike;
async _handle(payload: Payload) { async _handle(payload: Payload) {

View File

@@ -1,7 +1,7 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
export class GetRobotUinRange extends BaseAction<void, Array<any>> { export class GetRobotUinRange extends OneBotAction<void, Array<any>> {
actionName = ActionName.GetRobotUinRange; actionName = ActionName.GetRobotUinRange;
async _handle(payload: void) { 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 { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import { checkFileReceived, uri2local } from '@/common/file'; import { checkFileReceived, uri2local } from '@/common/file';
@@ -14,7 +14,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class OCRImage extends BaseAction<Payload, any> { export class OCRImage extends OneBotAction<Payload, any> {
actionName = ActionName.OCRImage; actionName = ActionName.OCRImage;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { GetPacketStatusDepends } from '../packet/GetPacketStatus';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -12,7 +12,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class SetGroupSign extends BaseAction<Payload, any> { export class SetGroupSign extends GetPacketStatusDepends<Payload, any> {
actionName = ActionName.SetGroupSign; actionName = ActionName.SetGroupSign;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,5 +1,5 @@
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { ChatType } from '@/core'; import { ChatType } from '@/core';
@@ -14,7 +14,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class SetInputStatus extends BaseAction<Payload, any> { export class SetInputStatus extends OneBotAction<Payload, any> {
actionName = ActionName.SetInputStatus; actionName = ActionName.SetInputStatus;
async _handle(payload: Payload) { 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 { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -12,7 +12,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class SetLongNick extends BaseAction<Payload, any> { export class SetLongNick extends OneBotAction<Payload, any> {
actionName = ActionName.SetLongNick; actionName = ActionName.SetLongNick;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
// 设置在线状态 // 设置在线状态
@@ -15,7 +15,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class SetOnlineStatus extends BaseAction<Payload, null> { export class SetOnlineStatus extends OneBotAction<Payload, null> {
actionName = ActionName.SetOnlineStatus; actionName = ActionName.SetOnlineStatus;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName, BaseCheckResult } from '../types'; import { ActionName, BaseCheckResult } from '../types';
import * as fs from 'node:fs'; import * as fs from 'node:fs';
import { checkFileReceived, uri2local } from '@/common/file'; import { checkFileReceived, uri2local } from '@/common/file';
@@ -7,7 +7,7 @@ interface Payload {
file: string; file: string;
} }
export default class SetAvatar extends BaseAction<Payload, null> { export default class SetAvatar extends OneBotAction<Payload, null> {
actionName = ActionName.SetQQAvatar; actionName = ActionName.SetQQAvatar;
// 用不着复杂检测 // 用不着复杂检测

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -14,7 +14,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class SharePeer extends BaseAction<Payload, any> { export class SharePeer extends OneBotAction<Payload, any> {
actionName = ActionName.SharePeer; actionName = ActionName.SharePeer;
payloadSchema = SchemaData; payloadSchema = SchemaData;
@@ -37,7 +37,7 @@ const SchemaDataGroupEx = {
type PayloadGroupEx = FromSchema<typeof SchemaDataGroupEx>; type PayloadGroupEx = FromSchema<typeof SchemaDataGroupEx>;
export class ShareGroupEx extends BaseAction<PayloadGroupEx, any> { export class ShareGroupEx extends OneBotAction<PayloadGroupEx, any> {
actionName = ActionName.ShareGroupEx; actionName = ActionName.ShareGroupEx;
payloadSchema = SchemaDataGroupEx; payloadSchema = SchemaDataGroupEx;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -15,7 +15,7 @@ const SchemaData = {
type Payload = FromSchema<typeof 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; actionName = ActionName.TranslateEnWordToZn;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import fs from 'fs/promises'; import fs from 'fs/promises';
import { FileNapCatOneBotUUID } from '@/common/helper'; import { FileNapCatOneBotUUID } from '@/common/helper';
import { ActionName } from '../types'; import { ActionName } from '../types';
@@ -30,7 +30,7 @@ const GetFileBase_PayloadSchema = {
export type GetFilePayload = FromSchema<typeof 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; payloadSchema = GetFileBase_PayloadSchema;
async _handle(payload: GetFilePayload): Promise<GetFileResponse> { async _handle(payload: GetFilePayload): Promise<GetFileResponse> {

View File

@@ -1,5 +1,5 @@
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
const SchemaData = { const SchemaData = {
@@ -13,7 +13,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class CreateGroupFileFolder extends BaseAction<Payload, any> { export class CreateGroupFileFolder extends OneBotAction<Payload, any> {
actionName = ActionName.GoCQHTTP_CreateGroupFileFolder; actionName = ActionName.GoCQHTTP_CreateGroupFileFolder;
payloadSchema = SchemaData; payloadSchema = SchemaData;
async _handle(payload: Payload) { async _handle(payload: Payload) {

View File

@@ -1,5 +1,5 @@
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FileNapCatOneBotUUID } from '@/common/helper'; import { FileNapCatOneBotUUID } from '@/common/helper';
@@ -14,7 +14,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class DeleteGroupFile extends BaseAction<Payload, any> { export class DeleteGroupFile extends OneBotAction<Payload, any> {
actionName = ActionName.GOCQHTTP_DeleteGroupFile; actionName = ActionName.GOCQHTTP_DeleteGroupFile;
payloadSchema = SchemaData; payloadSchema = SchemaData;
async _handle(payload: Payload) { async _handle(payload: Payload) {

View File

@@ -1,6 +1,6 @@
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import { ActionName } from '../types'; import { ActionName } from '../types';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
const SchemaData = { const SchemaData = {
type: 'object', type: 'object',
@@ -14,7 +14,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class DeleteGroupFileFolder extends BaseAction<Payload, any> { export class DeleteGroupFileFolder extends OneBotAction<Payload, any> {
actionName = ActionName.GoCQHTTP_DeleteGroupFileFolder; actionName = ActionName.GoCQHTTP_DeleteGroupFileFolder;
payloadSchema = SchemaData; payloadSchema = SchemaData;
async _handle(payload: Payload) { 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 { ActionName } from '../types';
import fs from 'fs'; import fs from 'fs';
import { join as joinPath } from 'node:path'; import { join as joinPath } from 'node:path';
@@ -28,7 +28,7 @@ const SchemaData = {
type Payload = FromSchema<typeof 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; actionName = ActionName.GoCQHTTP_DownloadFile;
payloadSchema = SchemaData; 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 { OB11Message, OB11MessageData, OB11MessageDataType, OB11MessageForward, OB11MessageNodePlain as OB11MessageNode } from '@/onebot';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -16,7 +16,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class GoCQHTTPGetForwardMsgAction extends BaseAction<Payload, any> { export class GoCQHTTPGetForwardMsgAction extends OneBotAction<Payload, any> {
actionName = ActionName.GoCQHTTP_GetForwardMsg; actionName = ActionName.GoCQHTTP_GetForwardMsg;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { OB11Message } from '@/onebot'; import { OB11Message } from '@/onebot';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { ChatType } from '@/core/entities'; import { ChatType } from '@/core/entities';
@@ -23,7 +23,7 @@ const SchemaData = {
type Payload = FromSchema<typeof 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; actionName = ActionName.GetFriendMsgHistory;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -11,7 +11,7 @@ const SchemaData = {
} as const satisfies JSONSchema; } as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class GoCQHTTPGetGroupAtAllRemain extends BaseAction<Payload, any> { export class GoCQHTTPGetGroupAtAllRemain extends OneBotAction<Payload, any> {
actionName = ActionName.GoCQHTTP_GetGroupAtAllRemain; actionName = ActionName.GoCQHTTP_GetGroupAtAllRemain;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,5 +1,5 @@
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
const SchemaData = { const SchemaData = {
@@ -12,7 +12,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class GetGroupFileSystemInfo extends BaseAction<Payload, { export class GetGroupFileSystemInfo extends OneBotAction<Payload, {
file_count: number, file_count: number,
limit_count: number, // unimplemented limit_count: number, // unimplemented
used_space: number, // TODO:unimplemented, but can be implemented later 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 { FromSchema, JSONSchema } from 'json-schema-to-ts';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { OB11Entities } from '@/onebot/entities'; import { OB11Entities } from '@/onebot/entities';
@@ -16,7 +16,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class GetGroupFilesByFolder extends BaseAction<any, any> { export class GetGroupFilesByFolder extends OneBotAction<any, any> {
actionName = ActionName.GoCQHTTP_GetGroupFilesByFolder; actionName = ActionName.GoCQHTTP_GetGroupFilesByFolder;
payloadSchema = SchemaData; payloadSchema = SchemaData;
async _handle(payload: Payload) { 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 { ActionName } from '../types';
import { WebHonorType } from '@/core/entities'; import { WebHonorType } from '@/core/entities';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -14,7 +14,7 @@ const SchemaData = {
// enum是不是有点抽象 // enum是不是有点抽象
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class GetGroupHonorInfo extends BaseAction<Payload, Array<any>> { export class GetGroupHonorInfo extends OneBotAction<Payload, Array<any>> {
actionName = ActionName.GetGroupHonorInfo; actionName = ActionName.GetGroupHonorInfo;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { OB11Message } from '@/onebot'; import { OB11Message } from '@/onebot';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { ChatType, Peer } from '@/core/entities'; import { ChatType, Peer } from '@/core/entities';
@@ -23,7 +23,7 @@ const SchemaData = {
type Payload = FromSchema<typeof 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; actionName = ActionName.GoCQHTTP_GetGroupMsgHistory;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,5 +1,5 @@
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { OB11GroupFile, OB11GroupFileFolder } from '@/onebot'; import { OB11GroupFile, OB11GroupFileFolder } from '@/onebot';
import { OB11Entities } from '@/onebot/entities'; import { OB11Entities } from '@/onebot/entities';
@@ -15,7 +15,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class GetGroupRootFiles extends BaseAction<Payload, { export class GetGroupRootFiles extends OneBotAction<Payload, {
files: OB11GroupFile[], files: OB11GroupFile[],
folders: OB11GroupFileFolder[], folders: OB11GroupFileFolder[],
}> { }> {
@@ -28,7 +28,7 @@ export class GetGroupRootFiles extends BaseAction<Payload, {
startIndex: 0, startIndex: 0,
sortOrder: 2, sortOrder: 2,
showOnlinedocFolder: 0, showOnlinedocFolder: 0,
}).catch(() => []); });
return { return {
files: ret.filter(item => item.fileInfo) files: ret.filter(item => item.fileInfo)

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { JSONSchema } from 'json-schema-to-ts'; import { JSONSchema } from 'json-schema-to-ts';
import { sleep } from '@/common/helper'; import { sleep } from '@/common/helper';
@@ -10,7 +10,7 @@ const SchemaData = {
}, },
} as const satisfies JSONSchema; } as const satisfies JSONSchema;
export class GetOnlineClient extends BaseAction<void, Array<any>> { export class GetOnlineClient extends OneBotAction<void, Array<any>> {
actionName = ActionName.GetOnlineClient; actionName = ActionName.GetOnlineClient;
async _handle(payload: void) { 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 { OB11User, OB11UserSex } from '@/onebot';
import { OB11Entities } from '@/onebot/entities'; import { OB11Entities } from '@/onebot/entities';
import { ActionName } from '../types'; import { ActionName } from '../types';
@@ -15,7 +15,7 @@ const SchemaData = {
type Payload = FromSchema<typeof 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; actionName = ActionName.GoCQHTTP_GetStrangerInfo;
async _handle(payload: Payload): Promise<OB11User> { 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 { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -11,7 +11,7 @@ const SchemaData = {
} as const satisfies JSONSchema; } as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class GoCQHTTPCheckUrlSafely extends BaseAction<Payload, any> { export class GoCQHTTPCheckUrlSafely extends OneBotAction<Payload, any> {
actionName = ActionName.GoCQHTTP_CheckUrlSafely; actionName = ActionName.GoCQHTTP_CheckUrlSafely;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -18,7 +18,7 @@ const SchemaData = {
} as const satisfies JSONSchema; } as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class GoCQHTTPDeleteFriend extends BaseAction<Payload, any> { export class GoCQHTTPDeleteFriend extends OneBotAction<Payload, any> {
actionName = ActionName.GoCQHTTP_DeleteFriend; actionName = ActionName.GoCQHTTP_DeleteFriend;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -10,7 +10,7 @@ const SchemaData = {
} as const satisfies JSONSchema; } as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class GoCQHTTPGetModelShow extends BaseAction<Payload, any> { export class GoCQHTTPGetModelShow extends OneBotAction<Payload, any> {
actionName = ActionName.GoCQHTTP_GetModelShow; actionName = ActionName.GoCQHTTP_GetModelShow;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -9,7 +9,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
//兼容性代码 //兼容性代码
export class GoCQHTTPSetModelShow extends BaseAction<Payload, any> { export class GoCQHTTPSetModelShow extends OneBotAction<Payload, any> {
actionName = ActionName.GoCQHTTP_SetModelShow; actionName = ActionName.GoCQHTTP_SetModelShow;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { QuickAction, QuickActionEvent } from '@/onebot/types'; import { QuickAction, QuickActionEvent } from '@/onebot/types';
@@ -7,7 +7,7 @@ interface Payload {
operation: QuickAction operation: QuickAction
} }
export class GoCQHTTPHandleQuickAction extends BaseAction<Payload, null> { export class GoCQHTTPHandleQuickAction extends OneBotAction<Payload, null> {
actionName = ActionName.GoCQHTTP_HandleQuickAction; actionName = ActionName.GoCQHTTP_HandleQuickAction;
async _handle(payload: Payload): Promise<null> { async _handle(payload: Payload): Promise<null> {

View File

@@ -1,5 +1,5 @@
import { checkFileReceived, uri2local } from '@/common/file'; import { checkFileReceived, uri2local } from '@/common/file';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { unlink } from 'node:fs'; import { unlink } from 'node:fs';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -21,7 +21,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class SendGroupNotice extends BaseAction<Payload, null> { export class SendGroupNotice extends OneBotAction<Payload, null> {
actionName = ActionName.GoCQHTTP_SendGroupNotice; actionName = ActionName.GoCQHTTP_SendGroupNotice;
async _handle(payload: Payload) { 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 { ActionName, BaseCheckResult } from '../types';
import * as fs from 'node:fs'; import * as fs from 'node:fs';
import { checkFileReceived, uri2local } from '@/common/file'; import { checkFileReceived, uri2local } from '@/common/file';
@@ -8,7 +8,7 @@ interface Payload {
group_id: number group_id: number
} }
export default class SetGroupPortrait extends BaseAction<Payload, any> { export default class SetGroupPortrait extends OneBotAction<Payload, any> {
actionName = ActionName.SetGroupPortrait; actionName = ActionName.SetGroupPortrait;
// 用不着复杂检测 // 用不着复杂检测

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -14,7 +14,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class SetQQProfile extends BaseAction<Payload, any> { export class SetQQProfile extends OneBotAction<Payload, any> {
actionName = ActionName.SetQQProfile; actionName = ActionName.SetQQProfile;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { ChatType, Peer } from '@/core/entities'; import { ChatType, Peer } from '@/core/entities';
import fs from 'fs'; import fs from 'fs';
@@ -20,7 +20,7 @@ const SchemaData = {
type Payload = FromSchema<typeof 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; actionName = ActionName.GoCQHTTP_UploadGroupFile;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { ChatType, Peer, SendFileElement } from '@/core/entities'; import { ChatType, Peer, SendFileElement } from '@/core/entities';
import fs from 'fs'; import fs from 'fs';
@@ -19,7 +19,7 @@ const SchemaData = {
type Payload = FromSchema<typeof 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; actionName = ActionName.GOCQHTTP_UploadPrivateFile;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import { MessageUnique } from '@/common/message-unique'; import { MessageUnique } from '@/common/message-unique';
@@ -13,7 +13,7 @@ const SchemaData = {
type Payload = FromSchema<typeof 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; actionName = ActionName.DelEssenceMsg;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -14,7 +14,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class DelGroupNotice extends BaseAction<Payload, any> { export class DelGroupNotice extends OneBotAction<Payload, any> {
actionName = ActionName.DelGroupNotice; actionName = ActionName.DelGroupNotice;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,5 +1,5 @@
import { ChatType, Peer } from '@/core'; import { ChatType, Peer } from '@/core';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import { MessageUnique } from '@/common/message-unique'; import { MessageUnique } from '@/common/message-unique';
@@ -16,7 +16,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class GetGroupEssence extends BaseAction<Payload, any> { export class GetGroupEssence extends OneBotAction<Payload, any> {
actionName = ActionName.GoCQHTTP_GetEssenceMsg; actionName = ActionName.GoCQHTTP_GetEssenceMsg;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,5 +1,5 @@
import { GroupNotifyMsgStatus } from '@/core'; import { GroupNotifyMsgStatus } from '@/core';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -12,7 +12,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class GetGroupIgnoredNotifies extends BaseAction<void, any> { export class GetGroupIgnoredNotifies extends OneBotAction<void, any> {
actionName = ActionName.GetGroupIgnoredNotifies; actionName = ActionName.GetGroupIgnoredNotifies;
async _handle(payload: void) { async _handle(payload: void) {

View File

@@ -1,6 +1,6 @@
import { OB11Group } from '@/onebot'; import { OB11Group } from '@/onebot';
import { OB11Entities } from '@/onebot/entities'; import { OB11Entities } from '@/onebot/entities';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -14,7 +14,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
class GetGroupInfo extends BaseAction<Payload, OB11Group> { class GetGroupInfo extends OneBotAction<Payload, OB11Group> {
actionName = ActionName.GetGroupInfo; actionName = ActionName.GetGroupInfo;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,6 +1,6 @@
import { OB11Group } from '@/onebot'; import { OB11Group } from '@/onebot';
import { OB11Entities } from '@/onebot/entities'; import { OB11Entities } from '@/onebot/entities';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
// no_cache get时传字符串 // no_cache get时传字符串
@@ -13,7 +13,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
class GetGroupList extends BaseAction<Payload, OB11Group[]> { class GetGroupList extends OneBotAction<Payload, OB11Group[]> {
actionName = ActionName.GetGroupList; actionName = ActionName.GetGroupList;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,6 +1,6 @@
import { OB11GroupMember } from '@/onebot'; import { OB11GroupMember } from '@/onebot';
import { OB11Entities } from '@/onebot/entities'; import { OB11Entities } from '@/onebot/entities';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -16,7 +16,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
class GetGroupMemberInfo extends BaseAction<Payload, OB11GroupMember> { class GetGroupMemberInfo extends OneBotAction<Payload, OB11GroupMember> {
actionName = ActionName.GetGroupMemberInfo; actionName = ActionName.GetGroupMemberInfo;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,6 +1,6 @@
import { OB11GroupMember } from '@/onebot'; import { OB11GroupMember } from '@/onebot';
import { OB11Entities } from '@/onebot/entities'; import { OB11Entities } from '@/onebot/entities';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -15,7 +15,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class GetGroupMemberList extends BaseAction<Payload, OB11GroupMember[]> { export class GetGroupMemberList extends OneBotAction<Payload, OB11GroupMember[]> {
actionName = ActionName.GetGroupMemberList; actionName = ActionName.GetGroupMemberList;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,5 +1,5 @@
import { WebApiGroupNoticeFeed } from '@/core'; import { WebApiGroupNoticeFeed } from '@/core';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -29,7 +29,7 @@ type Payload = FromSchema<typeof SchemaData>;
type ApiGroupNotice = GroupNotice & WebApiGroupNoticeFeed; type ApiGroupNotice = GroupNotice & WebApiGroupNoticeFeed;
export class GetGroupNotice extends BaseAction<Payload, GroupNotice[]> { export class GetGroupNotice extends OneBotAction<Payload, GroupNotice[]> {
actionName = ActionName.GoCQHTTP_GetGroupNotice; actionName = ActionName.GoCQHTTP_GetGroupNotice;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -12,7 +12,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class GetGroupShutList extends BaseAction<Payload, any> { export class GetGroupShutList extends OneBotAction<Payload, any> {
actionName = ActionName.GetGroupShutList; actionName = ActionName.GetGroupShutList;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import { MessageUnique } from '@/common/message-unique'; import { MessageUnique } from '@/common/message-unique';
@@ -13,7 +13,7 @@ const SchemaData = {
type Payload = FromSchema<typeof 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; actionName = ActionName.SetEssenceMsg;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { GroupRequestOperateTypes } from '@/core/entities'; import { GroupRequestOperateTypes } from '@/core/entities';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -15,7 +15,7 @@ const SchemaData = {
type Payload = FromSchema<typeof 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; actionName = ActionName.SetGroupAddRequest;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { GroupMemberRole } from '@/core/entities'; import { GroupMemberRole } from '@/core/entities';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -15,7 +15,7 @@ const SchemaData = {
type Payload = FromSchema<typeof 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; actionName = ActionName.SetGroupAdmin;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -14,7 +14,7 @@ const SchemaData = {
type Payload = FromSchema<typeof 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; actionName = ActionName.SetGroupBan;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -14,7 +14,7 @@ const SchemaData = {
type Payload = FromSchema<typeof 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; actionName = ActionName.SetGroupCard;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -15,7 +15,7 @@ const SchemaData = {
type Payload = FromSchema<typeof 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; actionName = ActionName.SetGroupKick;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -12,7 +12,7 @@ const SchemaData = {
} as const satisfies JSONSchema; } as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export default class SetGroupLeave extends BaseAction<Payload, any> { export default class SetGroupLeave extends OneBotAction<Payload, any> {
actionName = ActionName.SetGroupLeave; actionName = ActionName.SetGroupLeave;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,5 +1,5 @@
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
const SchemaData = { const SchemaData = {
@@ -12,7 +12,7 @@ const SchemaData = {
} as const satisfies JSONSchema; } as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export default class SetGroupName extends BaseAction<Payload, null> { export default class SetGroupName extends OneBotAction<Payload, null> {
actionName = ActionName.SetGroupName; actionName = ActionName.SetGroupName;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,5 +1,5 @@
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
const SchemaData = { const SchemaData = {
@@ -13,7 +13,7 @@ const SchemaData = {
type Payload = FromSchema<typeof 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; actionName = ActionName.SetGroupWholeBan;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,7 +1,7 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
export default class GetGuildList extends BaseAction<null, null> { export default class GetGuildList extends OneBotAction<null, null> {
actionName = ActionName.GetGuildList; actionName = ActionName.GetGuildList;
async _handle(payload: null): Promise<null> { 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'; import { ActionName } from '../types';
export default class GetGuildProfile extends BaseAction<null, null> { export default class GetGuildProfile extends OneBotAction<null, null> {
actionName = ActionName.GetGuildProfile; actionName = ActionName.GetGuildProfile;
async _handle(payload: null): Promise<null> { async _handle(payload: null): Promise<null> {

View File

@@ -8,7 +8,7 @@ import SendGroupMsg from './group/SendGroupMsg';
import SendPrivateMsg from './msg/SendPrivateMsg'; import SendPrivateMsg from './msg/SendPrivateMsg';
import SendMsg from './msg/SendMsg'; import SendMsg from './msg/SendMsg';
import DeleteMsg from './msg/DeleteMsg'; import DeleteMsg from './msg/DeleteMsg';
import BaseAction from './BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import GetVersionInfo from './system/GetVersionInfo'; import GetVersionInfo from './system/GetVersionInfo';
import CanSendRecord from './system/CanSendRecord'; import CanSendRecord from './system/CanSendRecord';
import CanSendImage from './system/CanSendImage'; import CanSendImage from './system/CanSendImage';
@@ -104,7 +104,7 @@ import { SendGroupAiRecord } from "@/onebot/action/group/SendGroupAiRecord";
import { GetAiCharacters } from "@/onebot/action/extends/GetAiCharacters"; 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 { export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCore): ActionMap {

View File

@@ -1,5 +1,5 @@
import { ActionName } from '../types'; import { ActionName } from '../types';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import { MessageUnique } from '@/common/message-unique'; import { MessageUnique } from '@/common/message-unique';
@@ -18,7 +18,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
class DeleteMsg extends BaseAction<Payload, void> { class DeleteMsg extends OneBotAction<Payload, void> {
actionName = ActionName.DeleteMsg; actionName = ActionName.DeleteMsg;
payloadSchema = SchemaData; 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 { ChatType, Peer } from '@/core/entities';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -16,7 +16,7 @@ const SchemaData = {
type Payload = FromSchema<typeof 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> { protected async getTargetPeer(payload: Payload): Promise<Peer> {
if (payload.user_id) { if (payload.user_id) {
const peerUid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString()); const peerUid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());

View File

@@ -1,5 +1,5 @@
import { OB11Message } from '@/onebot'; import { OB11Message } from '@/onebot';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import { MessageUnique } from '@/common/message-unique'; import { MessageUnique } from '@/common/message-unique';
@@ -19,7 +19,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
class GetMsg extends BaseAction<Payload, OB11Message> { class GetMsg extends OneBotAction<Payload, OB11Message> {
actionName = ActionName.GetMsg; actionName = ActionName.GetMsg;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,6 +1,6 @@
import { ChatType, Peer } from '@/core/entities'; import { ChatType, Peer } from '@/core/entities';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { MessageUnique } from '@/common/message-unique'; import { MessageUnique } from '@/common/message-unique';
@@ -15,7 +15,7 @@ const SchemaData = {
type PlayloadType = FromSchema<typeof SchemaData>; type PlayloadType = FromSchema<typeof SchemaData>;
class MarkMsgAsRead extends BaseAction<PlayloadType, null> { class MarkMsgAsRead extends OneBotAction<PlayloadType, null> {
async getPeer(payload: PlayloadType): Promise<Peer> { async getPeer(payload: PlayloadType): Promise<Peer> {
if (payload.message_id) { if (payload.message_id) {
const s_peer = MessageUnique.getMsgIdAndPeerByShortId(+payload.message_id)?.Peer; const s_peer = MessageUnique.getMsgIdAndPeerByShortId(+payload.message_id)?.Peer;
@@ -65,7 +65,7 @@ export class GoCQHTTPMarkMsgAsRead extends MarkMsgAsRead {
actionName = ActionName.GoCQHTTP_MarkMsgAsRead; actionName = ActionName.GoCQHTTP_MarkMsgAsRead;
} }
export class MarkAllMsgAsRead extends BaseAction<any, null> { export class MarkAllMsgAsRead extends OneBotAction<any, null> {
actionName = ActionName._MarkAllMsgAsRead; actionName = ActionName._MarkAllMsgAsRead;
async _handle(): Promise<null> { async _handle(): Promise<null> {

View File

@@ -10,7 +10,7 @@ import { ActionName, BaseCheckResult } from '@/onebot/action/types';
import { decodeCQCode } from '@/onebot/cqcode'; import { decodeCQCode } from '@/onebot/cqcode';
import { MessageUnique } from '@/common/message-unique'; import { MessageUnique } from '@/common/message-unique';
import { ChatType, ElementType, NapCatCore, Peer, RawMessage, SendArkElement, SendMessageElement } from '@/core'; 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 { ForwardMsgBuilder } from "@/common/forward-msg-builder";
import { stringifyWithBigInt } from "@/common/helper"; import { stringifyWithBigInt } from "@/common/helper";
import { PacketMsg } from "@/core/packet/message/message"; import { PacketMsg } from "@/core/packet/message/message";
@@ -88,7 +88,7 @@ function getSpecialMsgNum(payload: OB11PostSendMsg, msgType: OB11MessageDataType
return 0; return 0;
} }
export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> { export class SendMsg extends OneBotAction<OB11PostSendMsg, ReturnDataType> {
actionName = ActionName.SendMsg; actionName = ActionName.SendMsg;
contextMode = ContextMode.Normal; contextMode = ContextMode.Normal;

View File

@@ -1,5 +1,5 @@
import { ActionName } from '../types'; import { ActionName } from '../types';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import { MessageUnique } from '@/common/message-unique'; import { MessageUnique } from '@/common/message-unique';
@@ -15,7 +15,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class SetMsgEmojiLike extends BaseAction<Payload, any> { export class SetMsgEmojiLike extends OneBotAction<Payload, any> {
actionName = ActionName.SetMsgEmojiLike; actionName = ActionName.SetMsgEmojiLike;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,8 +1,8 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName, BaseCheckResult } from '../types'; 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; actionName = ActionName.GetPacketStatus;
protected async check(payload: PT): Promise<BaseCheckResult>{ 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'; import { ActionName } from '../types';
interface ReturnType { interface ReturnType {
yes: boolean; yes: boolean;
} }
export default class CanSendRecord extends BaseAction<any, ReturnType> { export default class CanSendRecord extends OneBotAction<any, ReturnType> {
actionName = ActionName.CanSendRecord; actionName = ActionName.CanSendRecord;
async _handle(_payload: void): Promise<ReturnType> { 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'; import { ActionName } from '../types';
export class GetCSRF extends BaseAction<any, any> { export class GetCSRF extends OneBotAction<any, any> {
actionName = ActionName.GetCSRF; actionName = ActionName.GetCSRF;
async _handle(payload: any) { 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 { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -17,7 +17,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class GetCredentials extends BaseAction<Payload, Response> { export class GetCredentials extends OneBotAction<Payload, Response> {
actionName = ActionName.GetCredentials; actionName = ActionName.GetCredentials;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,9 +1,9 @@
import { OB11User } from '@/onebot'; import { OB11User } from '@/onebot';
import { OB11Entities } from '@/onebot/entities'; import { OB11Entities } from '@/onebot/entities';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
class GetLoginInfo extends BaseAction<null, OB11User> { class GetLoginInfo extends OneBotAction<null, OB11User> {
actionName = ActionName.GetLoginInfo; actionName = ActionName.GetLoginInfo;
async _handle(payload: null) { async _handle(payload: null) {

View File

@@ -1,7 +1,7 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
export default class GetStatus extends BaseAction<any, any> { export default class GetStatus extends OneBotAction<any, any> {
actionName = ActionName.GetStatus; actionName = ActionName.GetStatus;
async _handle(payload: any): Promise<any> { async _handle(payload: any): Promise<any> {

View File

@@ -1,5 +1,5 @@
import { GroupNotifyMsgStatus } from '@/core'; import { GroupNotifyMsgStatus } from '@/core';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -12,7 +12,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class GetGroupSystemMsg extends BaseAction<void, any> { export class GetGroupSystemMsg extends OneBotAction<void, any> {
actionName = ActionName.GetGroupSystemMsg; actionName = ActionName.GetGroupSystemMsg;
async _handle(payload: void) { 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 { ActionName } from '../types';
import { napCatVersion } from '@/common/version'; import { napCatVersion } from '@/common/version';
export default class GetVersionInfo extends BaseAction<any, any> { export default class GetVersionInfo extends OneBotAction<any, any> {
actionName = ActionName.GetVersionInfo; actionName = ActionName.GetVersionInfo;
async _handle(payload: any): Promise<any> { 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 { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -17,7 +17,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export class GetCookies extends BaseAction<Payload, Response> { export class GetCookies extends OneBotAction<Payload, Response> {
actionName = ActionName.GetCookies; actionName = ActionName.GetCookies;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,6 +1,6 @@
import { OB11User } from '@/onebot'; import { OB11User } from '@/onebot';
import { OB11Entities } from '@/onebot/entities'; import { OB11Entities } from '@/onebot/entities';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -13,7 +13,7 @@ const SchemaData = {
} as const satisfies JSONSchema; } as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>; type Payload = FromSchema<typeof SchemaData>;
export default class GetFriendList extends BaseAction<Payload, OB11User[]> { export default class GetFriendList extends OneBotAction<Payload, OB11User[]> {
actionName = ActionName.GetFriendList; actionName = ActionName.GetFriendList;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,5 +1,5 @@
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { AdapterConfigWrap } from '@/onebot/config/config'; import { AdapterConfigWrap } from '@/onebot/config/config';
@@ -12,7 +12,7 @@ const SchemaData = {
type Payload = FromSchema<typeof 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; actionName = ActionName.GetRecentContact;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,4 +1,4 @@
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -13,7 +13,7 @@ const SchemaData = {
type Payload = FromSchema<typeof 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; actionName = ActionName.SendLike;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -1,5 +1,5 @@
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import BaseAction from '../BaseAction'; import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
const SchemaData = { const SchemaData = {
@@ -14,7 +14,7 @@ const SchemaData = {
type Payload = FromSchema<typeof 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; actionName = ActionName.SetFriendAddRequest;
payloadSchema = SchemaData; payloadSchema = SchemaData;

View File

@@ -20,7 +20,7 @@ import {
import faceConfig from '@/core/external/face_config.json'; import faceConfig from '@/core/external/face_config.json';
import { NapCatOneBot11Adapter, OB11Message, OB11MessageData, OB11MessageDataType, OB11MessageFileBase, } from '@/onebot'; import { NapCatOneBot11Adapter, OB11Message, OB11MessageData, OB11MessageDataType, OB11MessageFileBase, } from '@/onebot';
import { OB11Entities } from '@/onebot/entities'; import { OB11Entities } from '@/onebot/entities';
import { EventType } from '@/onebot/event/OB11BaseEvent'; import { EventType } from '@/onebot/event/OneBotEvent';
import { encodeCQCode } from '@/onebot/cqcode'; import { encodeCQCode } from '@/onebot/cqcode';
import { uri2local } from '@/common/file'; import { uri2local } from '@/common/file';
import { RequestUtil } from '@/common/request'; import { RequestUtil } from '@/common/request';

View File

@@ -8,7 +8,7 @@ export enum EventType {
MESSAGE_SENT = 'message_sent', MESSAGE_SENT = 'message_sent',
} }
export abstract class OB11BaseEvent { export abstract class OneBotEvent {
time = Math.floor(Date.now() / 1000); time = Math.floor(Date.now() / 1000);
self_id: number; self_id: number;
abstract post_type: EventType; 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; 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; post_type = EventType.META;
abstract meta_event_type: string; abstract meta_event_type: string;
} }

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