Merge branch 'type-enhancement' of https://github.com/NapNeko/NapCatQQ into type-enhancement

This commit is contained in:
pohgxz 2026-01-27 16:18:26 +08:00
commit 7a44ee02dc
7 changed files with 24 additions and 12 deletions

View File

@ -38,7 +38,7 @@ jobs:
- name: Build napcat-schema
run: |
cd packages/napcat-schema
pnpm run build:schema
pnpm run build:openapi
- name: Checkout NapCatDocs
uses: actions/checkout@v4

View File

@ -114,8 +114,9 @@ export class NTQQOnlineApi {
fileElement: {
fileName: actualFolderName,
filePath: folderPath,
fileSize: "",
},
} as any;
};
const msgService = this.context.session.getMsgService();
const startTime = Math.floor(Date.now() / 1000) - 2;
@ -173,7 +174,7 @@ export class NTQQOnlineApi {
* 线
* @param peer
*/
async getOnlineFileMsg (peer: Peer) : Promise<any> {
async getOnlineFileMsg (peer: Peer): Promise<any> {
const msgService = this.context.session.getMsgService();
return await msgService.getOnlineFileMsgs(peer);
}
@ -183,7 +184,7 @@ export class NTQQOnlineApi {
* @param peer
* @param msgId
*/
async cancelMyOnlineFileMsg (peer: Peer, msgId: string) : Promise<void> {
async cancelMyOnlineFileMsg (peer: Peer, msgId: string): Promise<void> {
const msgService = this.context.session.getMsgService();
await msgService.cancelSendMsg(peer, msgId);
}
@ -194,7 +195,7 @@ export class NTQQOnlineApi {
* @param msgId
* @param elementId
*/
async refuseOnlineFileMsg (peer: Peer, msgId: string, elementId: string) : Promise<void> {
async refuseOnlineFileMsg (peer: Peer, msgId: string, elementId: string): Promise<void> {
const msgService = this.context.session.getMsgService();
const arrToSend = {
msgId,
@ -215,7 +216,7 @@ export class NTQQOnlineApi {
* @param elementId
* @constructor
*/
async receiveOnlineFileOrFolder (peer: Peer, msgId: string, elementId: string) : Promise<any> {
async receiveOnlineFileOrFolder (peer: Peer, msgId: string, elementId: string): Promise<any> {
const msgService = this.context.session.getMsgService();
const arrToSend = {
msgId,
@ -233,7 +234,7 @@ export class NTQQOnlineApi {
* @param peer
* @param msgId
*/
async switchFileToOffline (peer: Peer, msgId: string) : Promise<void> {
async switchFileToOffline (peer: Peer, msgId: string): Promise<void> {
const msgService = this.context.session.getMsgService();
await msgService.switchToOfflineSendMsg(peer, msgId);
}

View File

@ -19,7 +19,8 @@ type ReturnType = Static<typeof ReturnSchema>;
export class ClickInlineKeyboardButton extends OneBotAction<PayloadType, ReturnType> {
override actionName = ActionName.ClickInlineKeyboardButton;
override payloadSchema = PayloadSchema;
override returnSchema = ReturnSchema; override actionSummary = '点击内联键盘按钮';
override returnSchema = ReturnSchema;
override actionSummary = '点击内联键盘按钮';
override actionTags = ['消息扩展'];
override payloadExample = {
group_id: '123456',

View File

@ -5,6 +5,7 @@ import { resolve, dirname } from 'node:path';
import { TSchema } from '@sinclair/typebox';
import { fileURLToPath } from 'node:url';
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
import { napCatVersion } from 'napcat-common/src/version';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
@ -69,7 +70,7 @@ export function generateOpenAPI () {
info: {
title: 'NapCat OneBot 11 HTTP API',
description: 'NapCatOneBot11 HTTP POST 接口文档',
version: '1.0.0'
version: napCatVersion
},
tags: [
{ name: '消息接口', description: '发送、删除、获取消息相关接口' },

View File

@ -5,11 +5,13 @@
"type": "module",
"main": "index.ts",
"scripts": {
"build:schema": "vite build & node ./dist/schemas.mjs"
"build:openapi": "vite build & node ./dist/schemas.mjs"
},
"dependencies": {
"@sinclair/typebox": "^0.34.38",
"napcat-onebot": "workspace:*"
"napcat-onebot": "workspace:*",
"napcat-common": "workspace:*",
"napcat-vite": "workspace:*"
},
"devDependencies": {
"tsx": "^4.7.1",

View File

@ -2,7 +2,7 @@ import { defineConfig } from 'vite';
import path, { resolve } from 'path';
import { builtinModules } from 'module';
import nodeResolve from '@rollup/plugin-node-resolve';
import napcatVersion from 'napcat-vite/vite-plugin-version';
// 依赖排除
const external = [
'ws',
@ -25,6 +25,7 @@ export default defineConfig({
},
plugins: [
nodeResolve(),
napcatVersion()
],
build: {
target: 'esnext',

View File

@ -261,9 +261,15 @@ importers:
'@sinclair/typebox':
specifier: ^0.34.38
version: 0.34.41
napcat-common:
specifier: workspace:*
version: link:../napcat-common
napcat-onebot:
specifier: workspace:*
version: link:../napcat-onebot
napcat-vite:
specifier: workspace:*
version: link:../napcat-vite
devDependencies:
tsx:
specifier: ^4.7.1