Compare commits

...

7 Commits

Author SHA1 Message Date
时瑾
4e3aa66e1d fix: 修复lint错误 - 标准化代码风格
- 将 == 改为 === 进行严格相等检查
- 修复未使用的变量,改为 _varName 格式
- 移除箭头函数中缺少的返回值
- 将 void 改为 undefined
- 移除无用的构造函数
- 修复 Promise 参数命名规范
- 移除不必要的转义符
- 添加 Service Worker 全局变量声明
- 修复未使用的类型参数
2026-02-12 14:48:37 +08:00
林小槐
82d0c51716 feat(webui): 插件商店增加插件详情弹窗并支持通过 url 传递 id 直接打开 (#1615)
Some checks failed
Build NapCat Artifacts / Build-Framework (push) Has been cancelled
Build NapCat Artifacts / Build-Shell (push) Has been cancelled
* feat(webui): 插件商店增加插件详情弹窗并支持通过 url 传递 id 直接打开

* fix(webui):type check
2026-02-11 12:12:06 +08:00
手瓜一十雪
37fb2d68d7 Prefer QQAppId/ marker when parsing AppID
Some checks failed
Build NapCat Artifacts / Build-Framework (push) Has been cancelled
Build NapCat Artifacts / Build-Shell (push) Has been cancelled
Add parseAppidFromMajorV2 to napcat-common to scan a Major file for the "QQAppId/" marker and extract a null-terminated numeric AppID. Update qq-basic-info to import and prefer this new parser (falling back to the existing parseAppidFromMajor). Also correct the getMajorPath argument order when obtaining the major file path. This enables detection of AppID from a newer Major format while preserving legacy fallback behavior.
2026-02-08 09:55:31 +08:00
手瓜一十雪
a240f93784 Add appid entry for 9.9.27-45758
Add a new mapping to packages/napcat-core/external/appid.json for version 9.9.27-45758 (Windows). The entry sets appid to 537340213 and qua to "V1_WIN_NQ_9.9.27_45758_GW_B".
2026-02-08 09:41:14 +08:00
时瑾
172a75b514 fix(webui-backend): sanitize plugin ID to prevent path injection (CodeQL js/path-injection)
Some checks failed
Build NapCat Artifacts / Build-Framework (push) Has been cancelled
Build NapCat Artifacts / Build-Shell (push) Has been cancelled
2026-02-07 13:52:15 +08:00
时瑾
beef1233fa fix(ci): 修复 Update apifox 步骤中因 OpenAPI 文件过大导致的参数列表过长错误 2026-02-07 13:44:25 +08:00
时瑾
8f69e2424a fix(backend): 修复插件列表接口新增字段导致的类型错误 2026-02-07 13:38:53 +08:00
193 changed files with 1902 additions and 1135 deletions

View File

@@ -84,8 +84,8 @@ export function generateBuildingComment (prSha: string, targets: string[]): stri
'',
'## 📋 构建信息',
'',
`| 项目 | 值 |`,
`| :--- | :--- |`,
'| 项目 | 值 |',
'| :--- | :--- |',
`| 📝 提交 | \`${shortSha}\` |`,
`| 🕐 开始时间 | ${time} |`,
'',
@@ -165,8 +165,8 @@ export function generateResultComment (
'',
'## 📋 构建信息',
'',
`| 项目 | 值 |`,
`| :--- | :--- |`,
'| 项目 | 值 |',
'| :--- | :--- |',
...(version ? [`| 🏷️ 版本号 | \`${version}\` |`] : []),
`| 📝 提交 | \`${shortSha}\` |`,
`| 🔗 构建日志 | [查看详情](${runUrl}) |`,
@@ -179,7 +179,7 @@ export function generateResultComment (
lines.push('', '---', '', '## ⚠️ 错误详情', '');
for (const target of failedTargets) {
lines.push(
`<details>`,
'<details>',
`<summary>🔴 <b>${target.name}</b> 构建错误</summary>`,
'',
'```',
@@ -228,4 +228,3 @@ export function generateResultComment (
return lines.join('\n');
}

View File

@@ -458,24 +458,23 @@ jobs:
pnpm i
pnpm run build:openapi
# 读取并压缩 openapi.json 内容
OPENAPI_CONTENT=$(cat packages/napcat-schema/dist/openapi.json | tr -d '\n\r\t' | sed 's/ */ /g' | sed 's/"/\\"/g')
# 构建 JSON 数据
JSON_DATA=$(printf '{
"input": "%s",
"options": {
# 使用 jq 安全地构建大型 JSON 数据并保存到文件
jq -n --rawfile input packages/napcat-schema/dist/openapi.json \
'{
input: $input,
options: {
"endpointOverwriteBehavior": "OVERWRITE_EXISTING",
"schemaOverwriteBehavior": "OVERWRITE_EXISTING",
"updateFolderOfChangedEndpoint": true,
"moduleId": 1140714,
"deleteUnmatchedResources": true
}
}' "$OPENAPI_CONTENT")
}' > apifox_payload.json
# 通过文件形式发送数据,避免命令行长度限制
curl --location -g --request POST 'https://api.apifox.com/v1/projects/5348325/import-openapi?locale=zh-CN' \
--header 'X-Apifox-Api-Version: 2024-03-28' \
--header "Authorization: Bearer $APIFOX_TOKEN" \
--header 'Content-Type: application/json' \
--data-raw "$JSON_DATA"
--data-binary @apifox_payload.json

3
.gitignore vendored
View File

@@ -10,6 +10,9 @@ devconfig/*
!.vscode/extensions.json
.idea/*
# macOS
.DS_Store
# Build
*.db
checkVersion.sh

View File

@@ -151,7 +151,7 @@ function httpDownloadWithProxy (url: string, headers: Record<string, string>, pr
const isTargetHttps = targetUrl.protocol === 'https:';
const proxyPort = parseInt(proxyUrl.port) || (proxyUrl.protocol === 'https:' ? 443 : 80);
// 代理认证头
const proxyAuthHeader = proxyUrl.username && proxyUrl.password
? { 'Proxy-Authorization': 'Basic ' + Buffer.from(`${decodeURIComponent(proxyUrl.username)}:${decodeURIComponent(proxyUrl.password)}`).toString('base64') }
@@ -165,7 +165,7 @@ function httpDownloadWithProxy (url: string, headers: Record<string, string>, pr
method: 'CONNECT',
path: `${targetUrl.hostname}:${targetUrl.port || 443}`,
headers: {
'Host': `${targetUrl.hostname}:${targetUrl.port || 443}`,
Host: `${targetUrl.hostname}:${targetUrl.port || 443}`,
...proxyAuthHeader,
},
});
@@ -179,7 +179,7 @@ function httpDownloadWithProxy (url: string, headers: Record<string, string>, pr
// 在隧道上建立 TLS 连接
const tlsSocket = tls.connect({
socket: socket,
socket,
servername: targetUrl.hostname,
rejectUnauthorized: true,
}, () => {
@@ -187,14 +187,14 @@ function httpDownloadWithProxy (url: string, headers: Record<string, string>, pr
const requestPath = targetUrl.pathname + targetUrl.search;
const requestHeaders = {
...headers,
'Host': targetUrl.hostname,
'Connection': 'close',
Host: targetUrl.hostname,
Connection: 'close',
};
const headerLines = Object.entries(requestHeaders)
.map(([key, value]) => `${key}: ${value}`)
.join('\r\n');
const httpRequest = `GET ${requestPath} HTTP/1.1\r\n${headerLines}\r\n\r\n`;
tlsSocket.write(httpRequest);
});
@@ -209,19 +209,19 @@ function httpDownloadWithProxy (url: string, headers: Record<string, string>, pr
tlsSocket.on('data', (chunk: Buffer) => {
responseData = Buffer.concat([responseData, chunk]);
if (!headersParsed) {
const headerEndIndex = responseData.indexOf('\r\n\r\n');
if (headerEndIndex !== -1) {
headersParsed = true;
const headerStr = responseData.subarray(0, headerEndIndex).toString();
const headerLines = headerStr.split('\r\n');
// 解析状态码
const statusLine = headerLines[0];
const statusMatch = statusLine?.match(/HTTP\/\d\.\d\s+(\d+)/);
statusCode = statusMatch ? parseInt(statusMatch[1]!) : 0;
// 解析响应头
for (const line of headerLines.slice(1)) {
const [key, ...valueParts] = line.split(':');
@@ -232,7 +232,7 @@ function httpDownloadWithProxy (url: string, headers: Record<string, string>, pr
redirectLocation = value;
}
}
bodyData = responseData.subarray(headerEndIndex + 4);
}
} else {
@@ -243,18 +243,18 @@ function httpDownloadWithProxy (url: string, headers: Record<string, string>, pr
tlsSocket.on('end', () => {
// 处理重定向
if (statusCode >= 300 && statusCode < 400 && redirectLocation) {
const redirectUrl = redirectLocation.startsWith('http')
? redirectLocation
const redirectUrl = redirectLocation.startsWith('http')
? redirectLocation
: `${targetUrl.protocol}//${targetUrl.host}${redirectLocation}`;
httpDownloadWithProxy(redirectUrl, headers, proxy).then(resolve).catch(reject);
return;
}
if (statusCode !== 200) {
reject(new Error(`下载失败: ${statusCode}`));
return;
}
// 处理 chunked 编码
if (isChunked) {
resolve(parseChunkedBody(bodyData));
@@ -282,7 +282,7 @@ function httpDownloadWithProxy (url: string, headers: Record<string, string>, pr
path: url, // 完整 URL
headers: {
...headers,
'Host': targetUrl.hostname,
Host: targetUrl.hostname,
...proxyAuthHeader,
},
}, (response) => {
@@ -304,26 +304,26 @@ function httpDownloadWithProxy (url: string, headers: Record<string, string>, pr
function parseChunkedBody (data: Buffer): Buffer {
const chunks: Buffer[] = [];
let offset = 0;
while (offset < data.length) {
// 查找 chunk 大小行的结束
const lineEnd = data.indexOf('\r\n', offset);
if (lineEnd === -1) break;
const sizeStr = data.subarray(offset, lineEnd).toString().split(';')[0]; // 忽略 chunk 扩展
const chunkSize = parseInt(sizeStr!, 16);
if (chunkSize === 0) break; // 最后一个 chunk
const chunkStart = lineEnd + 2;
const chunkEnd = chunkStart + chunkSize;
if (chunkEnd > data.length) break;
chunks.push(data.subarray(chunkStart, chunkEnd));
offset = chunkEnd + 2; // 跳过 chunk 数据后的 \r\n
}
return Buffer.concat(chunks);
}

View File

@@ -184,6 +184,35 @@ export function stringifyWithBigInt (obj: any) {
);
}
export function parseAppidFromMajorV2 (nodeMajor: string): string | undefined {
const marker = Buffer.from('QQAppId/', 'utf-8');
const filePath = path.resolve(nodeMajor);
const fileContent = fs.readFileSync(filePath);
let searchPosition = 0;
while (true) {
const index = fileContent.indexOf(marker, searchPosition);
if (index === -1) {
break;
}
const start = index + marker.length;
const end = fileContent.indexOf(0x00, start);
if (end === -1) {
break;
}
const content = fileContent.subarray(start, end);
const str = content.toString('utf-8');
if (/^\d+$/.test(str)) {
return str;
}
searchPosition = end + 1;
}
return undefined;
}
export function parseAppidFromMajor (nodeMajor: string): string | undefined {
const hexSequence = 'A4 09 00 00 00 35';
const sequenceBytes = Buffer.from(hexSequence.replace(/ /g, ''), 'hex');
@@ -224,7 +253,6 @@ export async function getAllTags (mirror?: string): Promise<{ tags: string[], mi
return getAllTagsFromMirror('NapNeko', 'NapCatQQ', mirror);
}
export async function getLatestTag (mirror?: string): Promise<string> {
const { tags } = await getAllTags(mirror);

View File

@@ -21,4 +21,4 @@ export interface ILogWrapper {
logWarn (...args: any[]): void;
logFatal (...args: any[]): void;
logMessage (msg: unknown, selfInfo: unknown): void;
}
}

View File

@@ -1,7 +1,7 @@
/**
* GitHub 镜像配置模块
* 提供统一的镜像源管理,支持复杂网络环境
*
*
* 镜像源测试时间: 2026-01-03
* 测试通过: 55/61 完全可用
*/
@@ -17,7 +17,7 @@ import { PromiseTimer } from './helper';
* GitHub 文件加速镜像
* 用于加速 release assets 下载
* 按延迟排序,优先使用快速镜像
*
*
* 测试时间: 2026-01-03
* 镜像支持 301/302 重定向
* 懒加载测速:首次使用时自动测速,缓存 30 分钟
@@ -74,7 +74,7 @@ export const GITHUB_FILE_MIRRORS = [
* GitHub API 镜像
* 用于访问 GitHub API作为备选方案
* 注:优先使用非 API 方法,减少对 API 的依赖
*
*
* 经测试,大部分代理镜像不支持 API 转发
* 建议使用 getLatestReleaseTag 等方法避免 API 调用
*/
@@ -271,8 +271,6 @@ async function performMirrorTest (): Promise<string[]> {
.sort((a, b) => a.latency - b.latency)
.map(r => r.mirror);
// 至少返回原始 URL
if (successfulMirrors.length === 0) {
return [''];
@@ -287,7 +285,6 @@ async function performMirrorTest (): Promise<string[]> {
export function clearMirrorCache (): void {
cachedFastMirrors = null;
cacheTimestamp = 0;
}
/**
@@ -664,7 +661,7 @@ export function buildReleaseDownloadUrl (
/**
* 获取 GitHub release 信息(优先使用非 API 方法)
*
*
* 策略:
* 1. 先通过 git refs 获取 tags
* 2. 直接构建下载 URL不依赖 API
@@ -725,7 +722,7 @@ export async function getGitHubRelease (
const response = await PromiseTimer(
RequestUtil.HttpGetJson<any>(url, 'GET', undefined, {
'User-Agent': 'NapCat',
'Accept': 'application/vnd.github.v3+json',
Accept: 'application/vnd.github.v3+json',
}),
currentConfig.timeout
);
@@ -958,7 +955,7 @@ async function getWorkflowRunsFromHtml (
allRuns.push({
id,
created_at: timeMatch[1],
title: title.trim()
title: title.trim(),
});
}
}
@@ -994,7 +991,7 @@ async function getWorkflowRunsFromHtml (
/**
* 通过 API 获取最新的 workflow runs然后直接拼接 nightly.link 下载链接
* 无需解析 HTML直接使用固定的 URL 格式
*
*
* 策略:
* 1. 优先使用 GitHub API
* 2. API 失败时,从 GitHub Actions HTML 页面解析
@@ -1042,7 +1039,6 @@ async function getArtifactsFromNightlyLink (
}
}
return { artifacts, mirror: runsMirror };
} catch {
return { artifacts: [], mirror: '' };
}
@@ -1051,7 +1047,7 @@ async function getArtifactsFromNightlyLink (
/**
* 获取 GitHub Action 最新运行的 artifacts
* 用于下载 nightly/dev 版本
*
*
* 策略:
* 1. 检查缓存10分钟有效
* 2. 优先尝试从 nightly.link 获取(无需认证,更稳定)

View File

@@ -3,4 +3,4 @@ export interface ISubscription {
subscribe (listener: LogListener): void;
unsubscribe (listener: LogListener): void;
notify (msg: string): void;
}
}

View File

@@ -33,7 +33,7 @@ export class NTQQFileApi {
'http://ss.xingzhige.com/music_card/rkey',
'https://secret-service.bietiaop.com/rkeys',
],
this.context.logger
this.context.logger
);
}

View File

@@ -114,7 +114,7 @@ export class NTQQOnlineApi {
fileElement: {
fileName: actualFolderName,
filePath: folderPath,
fileSize: "",
fileSize: '',
},
};

View File

@@ -164,8 +164,6 @@ export class NTQQWebApi {
imgWidth: number = 540,
imgHeight: number = 300
) {
const cookieObject = await this.core.apis.UserApi.getCookies('qun.qq.com');
try {
@@ -477,10 +475,10 @@ export class NTQQWebApi {
const client_key = Date.now() * 1000;
return await this.context.session.getAlbumService().doQunComment(
random_seq, {
map_info: [],
map_bytes_info: [],
map_user_account: [],
},
map_info: [],
map_bytes_info: [],
map_user_account: [],
},
qunId,
2,
createAlbumMediaFeed(uin, albumId, lloc),
@@ -511,13 +509,13 @@ export class NTQQWebApi {
const uin = this.core.selfInfo.uin || '10001';
return await this.context.session.getAlbumService().doQunLike(
random_seq, {
map_info: [],
map_bytes_info: [],
map_user_account: [],
}, {
id,
status: 1,
},
map_info: [],
map_bytes_info: [],
map_user_account: [],
}, {
id,
status: 1,
},
createAlbumFeedPublish(qunId, uin, albumId, lloc)
);
}

View File

@@ -212,7 +212,7 @@ export enum UploadSceneType {
KUPLOADSCENEH5LAUNCHCLIENTSHORTCUTKEYCTRLCV,
KUPLOADSCENEAIODRAG,
KUPLOADSCENEAIOFILESELECTOR,
KUPLOADSCENEAIOSHORTCUTKEYCTRLCV
KUPLOADSCENEAIOSHORTCUTKEYCTRLCV,
}
export interface StartFlashTaskRequests {
screen: number; // 1 PC-QQ
@@ -237,7 +237,7 @@ export interface StartFlashTaskRequests {
}
export enum BusiScene {
KBUSISCENEINVALID,
KBUSISCENEFLASHSCENE
KBUSISCENEFLASHSCENE,
}
export interface FileListInfoRequests {
seq: number, // 0
@@ -274,7 +274,7 @@ export enum DownloadSceneType {
KDOWNLOADSCENELINKOTHERINQQ,
KDOWNLOADSCENESCANQRCODE,
KDWONLOADSCENEFLASHTRANSFERCENTERCLIENT,
KDWONLOADSCENEFLASHTRANSFERCENTERSCHEMA
KDWONLOADSCENEFLASHTRANSFERCENTERSCHEMA,
}
export interface FlashFileSetInfo {
fileSetId: string,

View File

@@ -530,5 +530,9 @@
"3.2.25-45758": {
"appid": 537340249,
"qua": "V1_LNX_NQ_3.2.25_45758_GW_B"
},
"9.9.27-45758": {
"appid": 537340213,
"qua": "V1_WIN_NQ_9.9.27_45758_GW_B"
}
}

View File

@@ -22,7 +22,7 @@ export async function encodeSilk (filePath: string, TEMP_DIR: string, logger: Lo
return {
converted: true,
path: pttPath,
duration: duration,
duration,
};
} else {
let duration = 0;

View File

@@ -64,10 +64,12 @@ export class FFmpegService {
}
return this.adapter;
}
public static async convertToNTSilkTct (inputFile: string, outputFile: string): Promise<void> {
const adapter = await this.getAdapter();
await adapter.convertToNTSilkTct(inputFile, outputFile);
}
/**
* 设置 FFmpeg 路径并更新适配器
* @deprecated 建议使用 init() 方法初始化

View File

@@ -112,11 +112,11 @@ export class ForwardMsgBuilder {
preview: m.valid ? m.toPreview() : '[该消息类型暂不支持查看]',
})),
})),
source,
news,
summary,
prompt,
uuid,
source,
news,
summary,
prompt,
uuid
);
}
}

View File

@@ -1,6 +1,6 @@
import fs from 'node:fs';
import { systemPlatform } from 'napcat-common/src/system';
import { getDefaultQQVersionConfigInfo, getQQPackageInfoPath, getQQVersionConfigPath, parseAppidFromMajor } from 'napcat-common/src/helper';
import { getDefaultQQVersionConfigInfo, getQQPackageInfoPath, getQQVersionConfigPath, parseAppidFromMajor, parseAppidFromMajorV2 } from 'napcat-common/src/helper';
import AppidTable from '@/napcat-core/external/appid.json';
import { LogWrapper } from './log';
import { getMajorPath } from '@/napcat-core/index';
@@ -107,7 +107,13 @@ export class QQBasicInfoWrapper {
if (!this.QQMainPath) {
throw new Error('QQMainPath未定义 无法通过Major获取Appid');
}
const majorPath = getMajorPath(QQVersion, this.QQMainPath);
const majorPath = getMajorPath(this.QQMainPath, QQVersion);
// 优先通过 QQAppId/ 标记搜索
const appidV2 = parseAppidFromMajorV2(majorPath);
if (appidV2) {
return appidV2;
}
// 回落到旧方式
const appid = parseAppidFromMajor(majorPath);
return appid;
}

View File

@@ -6,13 +6,13 @@ import { NTEventWrapper } from './event';
* 创建 Service 方法的代理
* 拦截所有方法调用,通过 EventWrapper 进行调用
*/
function createServiceMethodProxy<S extends keyof ServiceNamingMapping>(
function createServiceMethodProxy<S extends keyof ServiceNamingMapping> (
serviceName: S,
originalService: ServiceNamingMapping[S],
eventWrapper: NTEventWrapper
): ServiceNamingMapping[S] {
return new Proxy(originalService as object, {
get(target, prop, receiver) {
get (target, prop, receiver) {
const originalValue = Reflect.get(target, prop, receiver);
// 如果不是函数,直接返回原始值
@@ -50,7 +50,7 @@ function createServiceMethodProxy<S extends keyof ServiceNamingMapping>(
* 第一层:拦截 getXXXService 方法
* 第二层:拦截 Service 上的具体方法调用
*/
export function createSessionProxy(
export function createSessionProxy (
session: NodeIQQNTWrapperSession,
eventWrapper: NTEventWrapper
): NodeIQQNTWrapperSession {
@@ -58,7 +58,7 @@ export function createSessionProxy(
const serviceProxyCache = new Map<string, unknown>();
return new Proxy(session, {
get(target, prop, receiver) {
get (target, prop, receiver) {
const propName = prop as string;
// 检查是否是 getXXXService 方法
@@ -105,7 +105,7 @@ export function createSessionProxy(
/**
* 检查 Service 名称是否在已知的映射中
*/
function isKnownService(serviceName: string): serviceName is keyof ServiceNamingMapping {
function isKnownService (serviceName: string): serviceName is keyof ServiceNamingMapping {
const knownServices: string[] = [
'NodeIKernelAvatarService',
'NodeIKernelBuddyService',
@@ -132,7 +132,7 @@ function isKnownService(serviceName: string): serviceName is keyof ServiceNaming
* 创建带有 EventWrapper 集成的 InstanceContext
* 这是推荐的使用方式,在创建 context 时自动代理 session
*/
export function createProxiedSession(
export function createProxiedSession (
session: NodeIQQNTWrapperSession,
eventWrapper: NTEventWrapper
): NodeIQQNTWrapperSession {

View File

@@ -53,6 +53,7 @@ export class NodeIKernelLoginListener {
onLoginState (..._args: any[]): any {
}
onLoginRecordUpdate (..._args: any[]): any {
}
}

View File

@@ -228,8 +228,9 @@ export class PacketOperationContext {
const res = trans.UploadForwardMsg.parse(resp);
return res.result.resId;
}
async UploadForwardMsgV2 (msg: UploadForwardMsgParams[], groupUin: number = 0) {
//await this.SendPreprocess(msg, groupUin);
// await this.SendPreprocess(msg, groupUin);
// 遍历上传资源
await Promise.allSettled(msg.map(async (item) => { return await this.SendPreprocess(item.actionMsg, groupUin); }));
const req = trans.UploadForwardMsgV2.build(this.context.napcore.basicInfo.uid, msg, groupUin);
@@ -237,6 +238,7 @@ export class PacketOperationContext {
const res = trans.UploadForwardMsg.parse(resp);
return res.result.resId;
}
async MoveGroupFile (
groupUin: number,
fileUUID: string,

View File

@@ -510,14 +510,14 @@ export class PacketMsgPttElement extends IPacketMsgElement<SendPttElement> {
}
override buildElement (): NapProtoEncodeStructType<typeof Elem>[] {
//return [];
// return [];
if (!this.msgInfo) return [];
return [{
commonElem: {
serviceType: 48,
pbElem: new NapProtoMsg(MsgInfo).encode(this.msgInfo),
businessType: 22,
}
},
}];
}

View File

@@ -14,7 +14,7 @@ class UploadForwardMsgV2 extends PacketTransformer<typeof proto.SendLongMsgResp>
actionCommand: item.actionCommand,
actionData: {
msgBody: this.msgBuilder.buildFakeMsg(selfUid, item.actionMsg),
}
},
}));
const longMsgResultData = new NapProtoMsg(proto.LongMsgResult).encode(
{

View File

@@ -2,4 +2,4 @@ export { default as UploadForwardMsg } from './UploadForwardMsg';
export { default as FetchGroupMessage } from './FetchGroupMessage';
export { default as FetchC2CMessage } from './FetchC2CMessage';
export { default as DownloadForwardMsg } from './DownloadForwardMsg';
export { default as UploadForwardMsgV2 } from './UploadForwardMsgV2';
export { default as UploadForwardMsgV2 } from './UploadForwardMsgV2';

View File

@@ -687,14 +687,14 @@ export interface NodeIKernelMsgService {
msgSeq: string;
msgRandom: string;
}>, DataMigrationResourceInfo: {
extraData: string;
filePath: string;
fileSize: string;
msgRandom: string;
msgSeq: string;
msgSubType: number;
msgType: number;
}): unknown;
extraData: string;
filePath: string;
fileSize: string;
msgRandom: string;
msgSeq: string;
msgSubType: number;
msgType: number;
}): unknown;
dataMigrationGetResourceLocalDestinyPath (...args: unknown[]): unknown;

View File

@@ -24,7 +24,7 @@ export interface NodeIKernelStorageCleanService {
// "C:\\Users\\nanaeo\\AppData\\Roaming\\QQ\\Partitions\\qqnt_9212"
// ]
// ]
addCacheScanedPaths (paths: Map<`tmp` | `SilentCacheappSessionPartation9212` | `hotUpdate`, unknown>): unknown;
addCacheScanedPaths (paths: Map<'tmp' | 'SilentCacheappSessionPartation9212' | 'hotUpdate', unknown>): unknown;
addFilesScanedPaths (arg: unknown): unknown;

View File

@@ -47,12 +47,12 @@ const itemsToCopy = [
'package.json',
'QBar.dll',
'wrapper.node',
'LightQuic.dll'
'LightQuic.dll',
];
const win64ItemsToCopy = [
'SSOShareInfoHelper64.dll',
'parent-ipc-core-x64.dll'
'parent-ipc-core-x64.dll',
];
async function copyAll () {

View File

@@ -158,7 +158,7 @@ function bufferToReadStream (buffer: Buffer): ReadStream {
read () {
this.push(buffer);
this.push(null);
}
},
});
return readable as unknown as ReadStream;
}

View File

@@ -63,7 +63,6 @@ export class JpegParser implements ImageParser {
const bufferSize = buffer.length;
const MIN_REQUIRED_BYTES = 10; // SOF段最低字节数
// 从JPEG头部后开始扫描
while (offset < bufferSize - MIN_REQUIRED_BYTES) {
// 寻找FF标记

View File

@@ -10,9 +10,9 @@ export const ActionExamples = {
errors: [
{ code: 1400, description: '请求参数错误或业务逻辑执行失败' },
{ code: 1401, description: '权限不足' },
{ code: 1404, description: '资源不存在' }
]
}
{ code: 1404, description: '资源不存在' },
],
},
};
export class OB11Response {

View File

@@ -9,9 +9,9 @@ export const ExtendsActionsExamples = {
{
type: 'string',
characters: [
{ character_id: 'id', character_name: 'name', preview_url: 'url' }
]
}
{ character_id: 'id', character_name: 'name', preview_url: 'url' },
],
},
],
},
GetClientkey: {

View File

@@ -27,10 +27,12 @@ export class ClickInlineKeyboardButton extends OneBotAction<PayloadType, ReturnT
bot_appid: '1234567890',
button_id: 'btn_1',
callback_data: '',
msg_seq: '10086'
msg_seq: '10086',
};
override returnExample = {
};
async _handle (payload: PayloadType) {
return await this.core.apis.MsgApi.clickInlineKeyboardButton({
buttonId: payload.button_id,

View File

@@ -21,11 +21,12 @@ export class CreateCollection extends OneBotAction<PayloadType, ReturnType> {
override actionTags = ['扩展接口'];
override payloadExample = {
rawData: '收藏内容',
brief: '收藏标题'
brief: '收藏标题',
};
override returnExample = {
result: 0,
errMsg: ''
errMsg: '',
};
async _handle (payload: PayloadType) {

View File

@@ -23,9 +23,11 @@ export class DelGroupAlbumMedia extends OneBotAction<PayloadType, ReturnType> {
album_id: 'album_id_1',
lloc: 'media_id_1',
};
override returnExample = {
result: {}
result: {},
};
override payloadSchema = PayloadSchema;
override returnSchema = ReturnSchema;

View File

@@ -19,11 +19,13 @@ export class DoGroupAlbumComment extends OneBotAction<DoGroupAlbumCommentPayload
group_id: '123456',
album_id: 'album_id_1',
lloc: 'media_id_1',
content: '很有意思'
content: '很有意思',
};
override returnExample = {
result: {}
result: {},
};
override payloadSchema = DoGroupAlbumCommentPayloadSchema;
override returnSchema = Type.Any({ description: '评论结果' });

View File

@@ -19,10 +19,11 @@ export class FetchCustomFace extends OneBotAction<PayloadType, ReturnType> {
override actionSummary = '获取自定义表情';
override actionTags = ['系统扩展'];
override payloadExample = {
count: 10
count: 10,
};
override returnExample = [
'http://example.com/face1.png'
'http://example.com/face1.png',
];
async _handle (payload: PayloadType) {
@@ -30,4 +31,3 @@ export class FetchCustomFace extends OneBotAction<PayloadType, ReturnType> {
return ret.emojiInfoList.map(e => e.url);
}
}

View File

@@ -8,7 +8,7 @@ const PayloadSchema = Type.Object({
emojiId: Type.Union([Type.Number(), Type.String()], { description: '表情ID' }),
emojiType: Type.Union([Type.Number(), Type.String()], { description: '表情类型' }),
count: Type.Union([Type.Number(), Type.String()], { default: 20, description: '获取数量' }),
cookie: Type.String({ default: '', description: '分页Cookie' })
cookie: Type.String({ default: '', description: '分页Cookie' }),
});
type PayloadType = Static<typeof PayloadSchema>;
@@ -37,22 +37,24 @@ export class FetchEmojiLike extends OneBotAction<PayloadType, ReturnType> {
emojiId: '123',
emojiType: 1,
count: 10,
cookie: ''
cookie: '',
};
override returnExample = {
emojiLikesList: [
{
tinyId: '123456',
nickName: '测试用户',
headUrl: 'http://example.com/avatar.png'
}
headUrl: 'http://example.com/avatar.png',
},
],
cookie: '',
isLastPage: true,
isFirstPage: true,
result: 0,
errMsg: ''
errMsg: '',
};
override payloadSchema = PayloadSchema;
override returnSchema = ReturnSchema;

View File

@@ -21,32 +21,33 @@ export class GetCollectionList extends OneBotAction<PayloadType, ReturnType> {
override actionTags = ['系统扩展'];
override payloadExample = {
category: '0',
count: '50'
count: '50',
};
override returnExample = {
errCode: 0,
errMsg: "",
errMsg: '',
collectionSearchList: {
collectionItemList: [
{
cid: "123456",
cid: '123456',
type: 8,
status: 1,
author: {
type: 2,
numId: "123456",
strId: "昵称",
groupId: "123456",
groupName: "群名",
uid: "123456"
numId: '123456',
strId: '昵称',
groupId: '123456',
groupName: '群名',
uid: '123456',
},
bid: 1,
category: 1,
createTime: "1769169157000",
collectTime: "1769413477691",
modifyTime: "1769413477691",
sequence: "1769413476735",
shareUrl: "",
createTime: '1769169157000',
collectTime: '1769413477691',
modifyTime: '1769413477691',
sequence: '1769413476735',
shareUrl: '',
customGroupId: 0,
securityBeat: false,
summary: {
@@ -58,21 +59,21 @@ export class GetCollectionList extends OneBotAction<PayloadType, ReturnType> {
fileSummary: null,
locationSummary: null,
richMediaSummary: {
title: "",
subTitle: "",
brief: "text",
title: '',
subTitle: '',
brief: 'text',
picList: [],
contentType: 1,
originalUri: "",
publisher: "",
richMediaVersion: 0
}
}
}
originalUri: '',
publisher: '',
richMediaVersion: 0,
},
},
},
],
hasMore: false,
bottomTimeStamp: "1769413477691"
}
bottomTimeStamp: '1769413477691',
},
};
async _handle (payload: PayloadType) {

View File

@@ -30,16 +30,18 @@ export class GetEmojiLikes extends OneBotAction<PayloadType, ReturnType> {
override actionTags = ['消息扩展'];
override payloadExample = {
message_id: '12345',
emoji_id: '123'
emoji_id: '123',
};
override returnExample = {
emoji_like_list: [
{
user_id: '654321',
nick_name: '测试用户'
}
]
nick_name: '测试用户',
},
],
};
override payloadSchema = PayloadSchema;
override returnSchema = ReturnSchema;
@@ -64,7 +66,7 @@ export class GetEmojiLikes extends OneBotAction<PayloadType, ReturnType> {
const emojiType = payload.emoji_type ?? (payload.emoji_id.length > 3 ? '2' : '1');
const emojiLikeList: Array<{ user_id: string; nick_name: string; }> = [];
let cookie = '';
let needFetchCount = payload.count == 0 ? 200 : Math.ceil(payload.count / 15);
const needFetchCount = payload.count === 0 ? 200 : Math.ceil(payload.count / 15);
for (let page = 0; page < needFetchCount; page++) {
const res = await this.core.apis.MsgApi.getMsgEmojiLikesList(
peer, msg.msgSeq, payload.emoji_id.toString(), emojiType, cookie, 15

View File

@@ -28,8 +28,8 @@ export class GetFriendWithCategory extends OneBotAction<void, ReturnType> {
categoryId: 1,
categoryName: '我的好友',
categoryMbCount: 1,
buddyList: []
}
buddyList: [],
},
];
async _handle () {

View File

@@ -37,8 +37,8 @@ export default class GetGroupAddRequest extends OneBotAction<void, ReturnType> {
group_name: '群名称',
checked: false,
actor: 0,
requester_nick: '请求者'
}
requester_nick: '请求者',
},
];
async _handle (): Promise<ReturnType> {

View File

@@ -22,11 +22,13 @@ export class GetGroupAlbumMediaList extends OneBotAction<PayloadType, ReturnType
group_id: '123456',
album_id: 'album_id_1',
};
override returnExample = {
media_list: [
{ media_id: 'media_id_1', url: 'http://example.com/1.jpg' }
]
{ media_id: 'media_id_1', url: 'http://example.com/1.jpg' },
],
};
override payloadSchema = PayloadSchema;
override returnSchema = ReturnSchema;

View File

@@ -16,11 +16,13 @@ export class GetGroupInfoEx extends OneBotAction<PayloadType, ReturnType> {
override actionSummary = '获取群详细信息 (扩展)';
override actionTags = ['群组扩展'];
override payloadExample = {
group_id: '123456'
group_id: '123456',
};
override returnExample = {
};
override payloadSchema = PayloadSchema;
override returnSchema = ReturnSchema;

View File

@@ -52,13 +52,15 @@ export class GetMiniAppArk extends GetPacketStatusDepends<PayloadType, ReturnTyp
title: '测试标题',
desc: '测试描述',
picUrl: 'http://example.com/pic.jpg',
jumpUrl: 'http://example.com'
jumpUrl: 'http://example.com',
};
override returnExample = {
data: {
ark: 'ark_content'
}
ark: 'ark_content',
},
};
async _handle (payload: PayloadType) {
let reqParam: MiniAppReqParams;
const customParams: MiniAppReqCustomParams = {

View File

@@ -39,8 +39,9 @@ export class GetProfileLike extends OneBotAction<PayloadType, ReturnType> {
override payloadExample = {
user_id: '123456789',
start: 0,
count: 10
count: 10,
};
override returnExample = {
uid: 'u_123',
time: '1734567890',
@@ -48,15 +49,15 @@ export class GetProfileLike extends OneBotAction<PayloadType, ReturnType> {
userInfos: [],
total_count: 10,
last_time: 1734567890,
today_count: 5
today_count: 5,
},
voteInfo: {
total_count: 100,
new_count: 2,
new_nearby_count: 0,
last_visit_time: 1734567890,
userInfos: []
}
userInfos: [],
},
};
async _handle (payload: PayloadType): Promise<ReturnType> {

View File

@@ -20,14 +20,16 @@ export class GetQunAlbumList extends OneBotAction<PayloadType, GetQunAlbumListRe
override payloadExample = {
group_id: '123456',
};
override returnExample = [
{
album_id: 'album_1',
album_name: '测试相册',
cover_url: 'http://example.com/cover.jpg',
create_time: 1734567890
}
create_time: 1734567890,
},
];
override payloadSchema = PayloadSchema;
override returnSchema = ReturnSchema;

View File

@@ -15,9 +15,9 @@ export class GetRkey extends GetPacketStatusDepends<void, ReturnType> {
override payloadExample = {};
override returnExample = [
{
"key": "rkey_value",
"expired": 1734567890
}
key: 'rkey_value',
expired: 1734567890,
},
];
async _handle () {

View File

@@ -12,8 +12,9 @@ export class GetRobotUinRange extends OneBotAction<void, ReturnType> {
override actionTags = ['系统扩展'];
override payloadExample = {};
override returnExample = [
{ minUin: '12345678', maxUin: '87654321' }
{ minUin: '12345678', maxUin: '87654321' },
];
override payloadSchema = Type.Object({});
override returnSchema = ReturnSchema;

View File

@@ -30,8 +30,8 @@ export class GetUnidirectionalFriendList extends OneBotAction<void, ReturnType>
uid: 'u_123',
nick_name: '单向好友',
age: 20,
source: '来源'
}
source: '来源',
},
];
async pack_data (data: string): Promise<Uint8Array> {

View File

@@ -22,11 +22,12 @@ export class GetUserStatus extends GetPacketStatusDepends<PayloadType, ReturnTyp
override actionSummary = '获取用户在线状态';
override actionTags = ['系统扩展'];
override payloadExample = {
user_id: '123456789'
user_id: '123456789',
};
override returnExample = {
status: 10,
ext_status: 0
ext_status: 0,
};
async _handle (payload: PayloadType) {

View File

@@ -28,9 +28,11 @@ export class MoveGroupFile extends GetPacketStatusDepends<PayloadType, ReturnTyp
current_parent_directory: '/current_folder_id',
target_parent_directory: '/target_folder_id',
};
override returnExample = {
ok: true
ok: true,
};
override payloadSchema = PayloadSchema;
override returnSchema = ReturnSchema;

View File

@@ -26,11 +26,13 @@ export class RenameGroupFile extends GetPacketStatusDepends<PayloadType, ReturnT
group_id: '123456',
file_id: '/file_id',
current_parent_directory: '/',
new_name: 'new_name.jpg'
new_name: 'new_name.jpg',
};
override returnExample = {
ok: true
ok: true,
};
override payloadSchema = PayloadSchema;
override returnSchema = ReturnSchema;

View File

@@ -24,8 +24,9 @@ export class SendPacket extends GetPacketStatusDepends<PayloadType, ReturnType>
override payloadExample = {
cmd: 'Example.Cmd',
data: '123456',
rsp: true
rsp: true,
};
override returnExample = '123456';
async _handle (payload: PayloadType) {

View File

@@ -23,8 +23,9 @@ export class SetDiyOnlineStatus extends OneBotAction<PayloadType, ReturnType> {
override payloadExample = {
face_id: '123',
face_type: '1',
wording: '自定义状态'
wording: '自定义状态',
};
override returnExample = '';
async _handle (payload: PayloadType) {
const ret = await this.core.apis.UserApi.setDiySelfOnlineStatus(

View File

@@ -23,6 +23,7 @@ export default class SetGroupAddOption extends OneBotAction<PayloadType, ReturnT
group_id: '123456',
add_type: 1,
};
override returnExample = null;
override payloadSchema = PayloadSchema;
override returnSchema = ReturnSchema;

View File

@@ -26,9 +26,11 @@ export class SetGroupAlbumMediaLike extends OneBotAction<PayloadType, ReturnType
lloc: 'media_id_1',
id: '123456',
};
override returnExample = {
result: {}
result: {},
};
override payloadSchema = PayloadSchema;
override returnSchema = ReturnSchema;

View File

@@ -22,8 +22,9 @@ export default class SetGroupRemark extends OneBotAction<PayloadType, ReturnType
override actionTags = ['群组扩展'];
override payloadExample = {
group_id: '123456',
remark: '测试群备注'
remark: '测试群备注',
};
override returnExample = null;
async _handle (payload: PayloadType): Promise<ReturnType> {

View File

@@ -19,8 +19,9 @@ export default class SetGroupRobotAddOption extends OneBotAction<PayloadType, Re
override actionSummary = '设置群机器人加群选项';
override actionTags = ['群组扩展'];
override payloadExample = {
group_id: '123456'
group_id: '123456',
};
override returnExample = null;
override payloadSchema = PayloadSchema;
override returnSchema = ReturnSchema;

View File

@@ -19,8 +19,9 @@ export default class SetGroupSearch extends OneBotAction<PayloadType, ReturnType
override actionSummary = '设置群搜索选项';
override actionTags = ['群组扩展'];
override payloadExample = {
group_id: '123456'
group_id: '123456',
};
override returnExample = null;
override payloadSchema = PayloadSchema;
override returnSchema = ReturnSchema;

View File

@@ -18,8 +18,9 @@ class SetGroupSignBase extends GetPacketStatusDepends<PayloadType, ReturnType> {
override actionSummary = '群打卡';
override actionTags = ['群组扩展'];
override payloadExample = {
group_id: '123456789'
group_id: '123456789',
};
override returnExample = null;
async _handle (payload: PayloadType) {

View File

@@ -22,8 +22,9 @@ export class SetInputStatus extends OneBotAction<PayloadType, ReturnType> {
override actionTags = ['系统扩展'];
override payloadExample = {
user_id: '123456789',
event_type: 1
event_type: 1,
};
override returnExample = null;
async _handle (payload: PayloadType) {

View File

@@ -24,8 +24,9 @@ export class SetOnlineStatus extends OneBotAction<PayloadType, ReturnType> {
override payloadExample = {
status: 11,
ext_status: 0,
battery_status: 100
battery_status: 100,
};
override returnExample = null;
async _handle (payload: PayloadType) {
@@ -252,4 +253,4 @@ const statusText = `
"battery_status": 0;
}
\`\`\`
`;
`;

View File

@@ -15,7 +15,6 @@ const ReturnSchema = Type.Any({ description: '分享结果' });
type ReturnType = Static<typeof ReturnSchema>;
export class SharePeerBase extends OneBotAction<PayloadType, ReturnType> {
override payloadSchema = PayloadSchema;
override returnSchema = ReturnSchema;
override actionSummary = '分享用户 (Ark)';
@@ -23,10 +22,11 @@ export class SharePeerBase extends OneBotAction<PayloadType, ReturnType> {
override actionTags = ['消息扩展'];
override payloadExample = {
user_id: '123456',
phone_number: ''
phone_number: '',
};
override returnExample = {
ark: '...'
ark: '...',
};
async _handle (payload: PayloadType) {
@@ -58,8 +58,9 @@ export class ShareGroupExBase extends OneBotAction<PayloadTypeGroupEx, ReturnTyp
override actionDescription = '获取群分享的 Ark 内容';
override actionTags = ['消息扩展'];
override payloadExample = {
group_id: '123456'
group_id: '123456',
};
override returnExample = '{"app": "com.tencent.structmsg", ...}';
async _handle (payload: PayloadTypeGroupEx) {
@@ -75,4 +76,4 @@ export class SendGroupArkShare extends ShareGroupExBase {
export class SendArkShare extends SharePeerBase {
override actionName = ActionName.SendArkShare;
}
}

View File

@@ -22,11 +22,13 @@ export class TransGroupFile extends GetPacketStatusDepends<PayloadType, ReturnTy
override actionTags = ['文件扩展'];
override payloadExample = {
group_id: '123456',
file_id: '/file_id'
file_id: '/file_id',
};
override returnExample = {
ok: true
ok: true,
};
override payloadSchema = PayloadSchema;
override returnSchema = ReturnSchema;

View File

@@ -32,7 +32,7 @@ export class TranslateEnWordToZn extends OneBotAction<PayloadType, ReturnType> {
throw new Error('翻译失败');
}
return {
words: ret.words
words: ret.words,
};
}
}

View File

@@ -26,11 +26,13 @@ export class UploadImageToQunAlbum extends OneBotAction<PayloadType, ReturnType>
group_id: '123456',
album_id: 'album_id_1',
album_name: '相册1',
file: '/path/to/image.jpg'
file: '/path/to/image.jpg',
};
override returnExample = {
result: null
result: null,
};
override payloadSchema = PayloadSchema;
override returnSchema = ReturnSchema;

View File

@@ -26,10 +26,11 @@ export class CreateFlashTask extends OneBotAction<CreateFlashTaskPayload, any> {
override actionTags = ['文件扩展'];
override payloadExample = {
files: 'C:\\test.jpg',
name: 'test_task'
name: 'test_task',
};
override returnExample = {
task_id: 'task_123'
task_id: 'task_123',
};
async _handle (payload: CreateFlashTaskPayload) {

View File

@@ -15,8 +15,9 @@ export class DownloadFileset extends OneBotAction<DownloadFilesetPayload, any> {
override actionSummary = '下载文件集';
override actionTags = ['文件扩展'];
override payloadExample = {
fileset_id: 'set_123'
fileset_id: 'set_123',
};
override returnExample = null;
async _handle (payload: DownloadFilesetPayload) {

View File

@@ -12,15 +12,17 @@ export class GetFilesetId extends OneBotAction<GetFilesetIdPayload, { fileset_id
override actionName = ActionName.GetFilesetId;
override payloadSchema = GetFilesetIdPayloadSchema;
override returnSchema = Type.Object({
fileset_id: Type.String({ description: '文件集 ID' })
fileset_id: Type.String({ description: '文件集 ID' }),
});
override actionSummary = '获取文件集 ID';
override actionTags = ['文件扩展'];
override payloadExample = {
share_code: '123456'
share_code: '123456',
};
override returnExample = {
fileset_id: 'set_123'
fileset_id: 'set_123',
};
async _handle (payload: GetFilesetIdPayload) {

View File

@@ -15,11 +15,12 @@ export class GetFilesetInfo extends OneBotAction<GetFilesetInfoPayload, any> {
override actionSummary = '获取文件集信息';
override actionTags = ['文件扩展'];
override payloadExample = {
fileset_id: 'set_123'
fileset_id: 'set_123',
};
override returnExample = {
fileset_id: 'set_123',
file_list: []
file_list: [],
};
async _handle (payload: GetFilesetInfoPayload) {

View File

@@ -15,13 +15,14 @@ export class GetFlashFileList extends OneBotAction<GetFlashFileListPayload, any>
override actionSummary = '获取闪传文件列表';
override actionTags = ['文件扩展'];
override payloadExample = {
fileset_id: 'set_123'
fileset_id: 'set_123',
};
override returnExample = [
{
file_name: 'test.jpg',
size: 1024
}
size: 1024,
},
];
async _handle (payload: GetFlashFileListPayload) {

View File

@@ -17,10 +17,11 @@ export class GetFlashFileUrl extends OneBotAction<GetFlashFileUrlPayload, any> {
override actionSummary = '获取闪传文件链接';
override actionTags = ['文件扩展'];
override payloadExample = {
fileset_id: 'set_123'
fileset_id: 'set_123',
};
override returnExample = {
url: 'http://example.com/flash.jpg'
url: 'http://example.com/flash.jpg',
};
async _handle (payload: GetFlashFileUrlPayload) {

View File

@@ -15,8 +15,9 @@ export class GetShareLink extends OneBotAction<GetShareLinkPayload, any> {
override actionSummary = '获取文件分享链接';
override actionTags = ['文件扩展'];
override payloadExample = {
fileset_id: 'set_123'
fileset_id: 'set_123',
};
override returnExample = 'http://example.com/share';
async _handle (payload: GetShareLinkPayload) {

View File

@@ -19,10 +19,11 @@ export class SendFlashMsg extends OneBotAction<SendFlashMsgPayload, any> {
override actionTags = ['文件扩展'];
override payloadExample = {
fileset_id: 'set_123',
user_id: '123456789'
user_id: '123456789',
};
override returnExample = {
message_id: 123456
message_id: 123456,
};
async _handle (payload: SendFlashMsgPayload) {

View File

@@ -18,8 +18,9 @@ export class CancelOnlineFile extends OneBotAction<CancelOnlineFilePayload, any>
override actionTags = ['文件扩展'];
override payloadExample = {
user_id: '123456789',
msg_id: '123'
msg_id: '123',
};
override returnExample = null;
async _handle (payload: CancelOnlineFilePayload) {

View File

@@ -16,8 +16,9 @@ export class GetOnlineFileMessages extends OneBotAction<GetOnlineFileMessagesPay
override actionSummary = '获取在线文件消息';
override actionTags = ['文件扩展'];
override payloadExample = {
user_id: '123456789'
user_id: '123456789',
};
override returnExample = [];
async _handle (payload: GetOnlineFileMessagesPayload) {

View File

@@ -20,8 +20,9 @@ export class ReceiveOnlineFile extends OneBotAction<ReceiveOnlineFilePayload, an
override payloadExample = {
user_id: '123456789',
msg_id: '123',
save_path: 'C:\\save'
save_path: 'C:\\save',
};
override returnExample = null;
async _handle (payload: ReceiveOnlineFilePayload) {

View File

@@ -19,8 +19,9 @@ export class RefuseOnlineFile extends OneBotAction<RefuseOnlineFilePayload, any>
override actionTags = ['文件扩展'];
override payloadExample = {
user_id: '123456789',
msg_id: '123'
msg_id: '123',
};
override returnExample = null;
async _handle (payload: RefuseOnlineFilePayload) {

View File

@@ -20,8 +20,9 @@ export class SendOnlineFile extends OneBotAction<SendOnlineFilePayload, any> {
override payloadExample = {
user_id: '123456789',
file_path: 'C:\\path\\to\\file.txt',
file_name: 'test.txt'
file_name: 'test.txt',
};
override returnExample = null;
async _handle (payload: SendOnlineFilePayload) {

View File

@@ -19,8 +19,9 @@ export class SendOnlineFolder extends OneBotAction<SendOnlineFolderPayload, any>
override actionTags = ['文件扩展'];
override payloadExample = {
user_id: '123456789',
folder_path: 'C:\\path\\to\\folder'
folder_path: 'C:\\path\\to\\folder',
};
override returnExample = null;
async _handle (payload: SendOnlineFolderPayload) {

View File

@@ -28,11 +28,12 @@ export class CreateGroupFileFolder extends OneBotAction<PayloadType, ReturnType>
override actionTags = ['Go-CQHTTP'];
override payloadExample = {
group_id: '123456789',
folder_name: '新建文件夹'
folder_name: '新建文件夹',
};
override returnExample = {
result: {},
groupItem: {}
groupItem: {},
};
async _handle (payload: PayloadType) {

View File

@@ -145,7 +145,7 @@ export class GoCQHTTPGetForwardMsgAction extends OneBotAction<PayloadType, Retur
if (rootMsg) {
// 5. 获取消息内容
const data = await this.core.apis.MsgApi.getMsgHistory(rootMsg.Peer, rootMsg.MsgId, 1);//getMsgsIncludeSelf
const data = await this.core.apis.MsgApi.getMsgHistory(rootMsg.Peer, rootMsg.MsgId, 1);// getMsgsIncludeSelf
if (data && data.result === 0 && data.msgList.length > 0) {
const singleMsg = data.msgList[0];

View File

@@ -18,10 +18,11 @@ export class GoCQHTTPSendForwardMsg extends GoCQHTTPSendForwardMsgBase {
override actionTags = ['Go-CQHTTP'];
override payloadExample = {
group_id: '123456789',
messages: []
messages: [],
};
override returnExample = {
message_id: 123456
message_id: 123456,
};
protected override async check (payload: GoCQHTTPSendForwardMsgPayload) {
@@ -35,11 +36,13 @@ export class GoCQHTTPSendPrivateForwardMsg extends GoCQHTTPSendForwardMsgBase {
override actionTags = ['Go-CQHTTP'];
override payloadExample = {
user_id: '123456789',
messages: []
messages: [],
};
override returnExample = {
message_id: 123456
message_id: 123456,
};
override async _handle (payload: GoCQHTTPSendForwardMsgPayload): Promise<ReturnDataType> {
return this.base_handle(payload, ContextMode.Private);
}
@@ -51,11 +54,13 @@ export class GoCQHTTPSendGroupForwardMsg extends GoCQHTTPSendForwardMsgBase {
override actionTags = ['Go-CQHTTP'];
override payloadExample = {
group_id: '123456789',
messages: []
messages: [],
};
override returnExample = {
message_id: 123456
message_id: 123456,
};
override async _handle (payload: GoCQHTTPSendForwardMsgPayload): Promise<ReturnDataType> {
return this.base_handle(payload, ContextMode.Group);
}

View File

@@ -25,8 +25,9 @@ export class GetAiRecord extends GetPacketStatusDepends<PayloadType, ReturnType>
override payloadExample = {
character: 'ai_char_1',
group_id: '123456',
text: '你好'
text: '你好',
};
override returnExample = 'http://example.com/ai_voice.silk';
async _handle (payload: PayloadType) {

View File

@@ -26,7 +26,7 @@ export class GetGroupIgnoredNotifies extends OneBotAction<PayloadType, ReturnTyp
override returnExample = {
invited_requests: [],
InvitedRequest: [],
join_requests: []
join_requests: [],
};
async _handle (): Promise<ReturnType> {

View File

@@ -63,7 +63,7 @@ export class GetGroupNotice extends OneBotAction<PayloadType, ReturnType> {
images: image,
},
settings: retApiNotice.settings,
read_num: retApiNotice.read_num
read_num: retApiNotice.read_num,
};
retNotices.push(retNotice);
}

View File

@@ -19,14 +19,15 @@ export class GetGroupShutList extends OneBotAction<PayloadType, ReturnType> {
override actionSummary = '获取群禁言列表';
override actionTags = ['群组接口'];
override payloadExample = {
group_id: '123456789'
group_id: '123456789',
};
override returnExample = [
{
user_id: 123456789,
nickname: '禁言用户',
shut_up_time: 1734567890
}
shut_up_time: 1734567890,
},
];
async _handle (payload: PayloadType) {

View File

@@ -27,8 +27,9 @@ export class SendGroupAiRecord extends GetPacketStatusDepends<PayloadType, Retur
override payloadExample = {
character: 'ai_char_1',
group_id: '123456',
text: '你好'
text: '你好',
};
override returnExample = {};
async _handle (payload: PayloadType) {

View File

@@ -21,8 +21,9 @@ class DeleteMsg extends OneBotAction<PayloadType, ReturnType> {
override actionDescription = '撤回已发送的消息';
override actionTags = ['消息接口'];
override payloadExample = {
message_id: 12345
message_id: 12345,
};
override returnExample = null;
async _handle (payload: PayloadType) {

View File

@@ -22,8 +22,9 @@ class ForwardSingleMsg extends OneBotAction<PayloadType, ReturnType> {
override actionTags = ['消息接口'];
override payloadExample = {
message_id: 12345,
group_id: '123456'
group_id: '123456',
};
override returnExample = null;
protected async getTargetPeer (payload: PayloadType): Promise<Peer> {

View File

@@ -60,6 +60,7 @@ class GetMsg extends OneBotAction<PayloadType, ReturnType> {
emoji_type: emoji.emojiType,
likes_cnt: emoji.likesCnt,
});
return undefined;
});
try {
retMsg.message_id = MessageUnique.createUniqueMsgId(peer, msg.msgId)!;

View File

@@ -21,8 +21,9 @@ class MarkMsgAsRead extends OneBotAction<PayloadType, ReturnType> {
override actionDescription = '标记指定渠道的消息为已读';
override actionTags = ['消息接口'];
override payloadExample = {
message_id: 12345
message_id: 12345,
};
override returnExample = null;
async getPeer (payload: PayloadType): Promise<Peer> {

View File

@@ -219,7 +219,7 @@ export class SendMsgBase extends OneBotAction<SendMsgPayload, ReturnDataType> {
} | null> {
const packetMsg: PacketMsg[] = [];
const delFiles: string[] = [];
const innerMsg: Array<{ uuid: string, packetMsg: PacketMsg[]; }> = new Array();
const innerMsg: Array<{ uuid: string, packetMsg: PacketMsg[]; }> = [];
for (const node of messageNodes) {
if (dp >= 3) {
this.core.context.logger.logWarn('转发消息深度超过3层将停止解析');
@@ -243,7 +243,6 @@ export class SendMsgBase extends OneBotAction<SendMsgPayload, ReturnDataType> {
innerMsg.push({ uuid: m.uuid, packetMsg: m.packetMsg });
});
}
} else {
const sendElementsCreateReturn = await this.obContext.apis.MsgApi.createSendElements(OB11Data, msgPeer);
sendElements = sendElementsCreateReturn.sendElements;
@@ -308,8 +307,8 @@ export class SendMsgBase extends OneBotAction<SendMsgPayload, ReturnDataType> {
},
} as SendArkElement,
res_id: resid,
uuid: uuid,
packetMsg: packetMsg,
uuid,
packetMsg,
innerPacketMsg: innerMsg,
};
}

View File

@@ -9,10 +9,11 @@ class SendPrivateMsg extends SendMsgBase {
override actionTags = ['消息接口'];
override payloadExample = {
user_id: '123456789',
message: 'hello'
message: 'hello',
};
override returnExample = {
message_id: 123456
message_id: 123456,
};
protected override async check (payload: SendMsgPayload): Promise<BaseCheckResult> {

View File

@@ -22,11 +22,13 @@ export class SetMsgEmojiLike extends OneBotAction<PayloadType, ReturnType> {
override payloadExample = {
message_id: 12345,
emoji_id: '123',
set: true
set: true,
};
override returnExample = {
result: true
result: true,
};
override payloadSchema = PayloadSchema;
override returnSchema = ReturnSchema;

View File

@@ -20,8 +20,9 @@ export class SetDoubtFriendsAddRequest extends OneBotAction<SetDoubtFriendsAddRe
override actionTags = ['系统接口'];
override payloadExample = {
flag: '12345',
approve: true
approve: true,
};
override returnExample = null;
async _handle (payload: SetDoubtFriendsAddRequestPayload) {

View File

@@ -23,8 +23,8 @@ export class GetRkeyEx extends GetPacketStatusDepends<void, GetRkeyExReturn> {
type: 'private',
rkey: 'rkey_123',
created_at: 1734567890,
ttl: 3600
}
ttl: 3600,
},
];
async _handle () {

View File

@@ -22,6 +22,7 @@ export class GetRkeyServer extends GetPacketStatusDepends<void, GetRkeyServerRet
expired_time: 1694560000,
name: 'NapCat 4',
};
override payloadSchema = Type.Object({});
override returnSchema = GetRkeyServerReturnSchema;

View File

@@ -94,5 +94,5 @@ export const OB11MessageSchema = Type.Intersect([
emoji_type: Type.String({ description: '表情符号类型' }),
likes_cnt: Type.String({ description: '点赞数' }),
})),
}, { description: 'OneBot 11 消息信息' })
], { $id: 'OB11ActionMessage', description: 'OneBot 11 消息信息' });
}, { description: 'OneBot 11 消息信息' }),
], { $id: 'OB11ActionMessage', description: 'OneBot 11 消息信息' });

View File

@@ -10,8 +10,9 @@ export class CleanStreamTempFile extends OneBotAction<void, void> {
override actionTags = ['流式传输扩展'];
override payloadExample = {};
override returnExample = {
message: 'success'
message: 'success',
};
override payloadSchema = Type.Object({});
override returnSchema = Type.Null();

View File

@@ -20,11 +20,13 @@ export class DownloadFileImageStream extends BaseDownloadStream<DownloadFileImag
override actionSummary = '下载图片文件流';
override actionTags = ['流式传输扩展'];
override payloadExample = {
file: 'image_file_id'
file: 'image_file_id',
};
override returnExample = {
file: 'temp_image_path'
file: 'temp_image_path',
};
override payloadSchema = DownloadFileImageStreamPayloadSchema;
override returnSchema = Type.Any({ description: '下载结果 (流式)' });
override useStream = true;

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