mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-04 06:31:13 +00:00
Update OpenAPI version and use dynamic version from napcat-common
Changed OpenAPI spec version to 3.1.0 and replaced the hardcoded API version with napCatVersion from napcat-common. Added napcat-common as a dependency in package.json.
This commit is contained in:
parent
23b475a3dc
commit
795e64a924
@ -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);
|
||||
}
|
||||
|
||||
@ -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',
|
||||
@ -29,7 +30,7 @@ export class ClickInlineKeyboardButton extends OneBotAction<PayloadType, ReturnT
|
||||
msg_seq: '10086'
|
||||
};
|
||||
override returnExample = {
|
||||
} as any;
|
||||
};
|
||||
async _handle (payload: PayloadType) {
|
||||
return await this.core.apis.MsgApi.clickInlineKeyboardButton({
|
||||
buttonId: payload.button_id,
|
||||
|
||||
@ -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);
|
||||
@ -65,11 +66,11 @@ export function generateOpenAPI () {
|
||||
}
|
||||
|
||||
const openapi: Record<string, unknown> = {
|
||||
openapi: '3.0.1',
|
||||
openapi: '3.1.0',
|
||||
info: {
|
||||
title: 'NapCat OneBot 11 HTTP API',
|
||||
description: 'NapCatOneBot11 HTTP POST 接口文档',
|
||||
version: '1.0.0'
|
||||
version: napCatVersion
|
||||
},
|
||||
tags: [
|
||||
{ name: '消息接口', description: '发送、删除、获取消息相关接口' },
|
||||
|
||||
@ -9,7 +9,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@sinclair/typebox": "^0.34.38",
|
||||
"napcat-onebot": "workspace:*"
|
||||
"napcat-onebot": "workspace:*",
|
||||
"napcat-common": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tsx": "^4.7.1",
|
||||
|
||||
@ -261,6 +261,9 @@ 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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user