mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-04 14:41:14 +00:00
Refactor action examples structure and imports
Moved action example files into a new 'example' directory and updated all imports accordingly. Removed the monolithic 'examples.ts' and redefined ActionExamples in OneBotAction.ts to only include common error codes. This improves code organization and maintainability.
This commit is contained in:
parent
7a44ee02dc
commit
1fa0980709
@ -5,7 +5,15 @@ import { NapCatOneBot11Adapter, OB11Return } from '@/napcat-onebot/index';
|
||||
import { NetworkAdapterConfig } from '../config/config';
|
||||
import { TSchema } from '@sinclair/typebox';
|
||||
import { StreamPacket, StreamPacketBasic, StreamStatus } from './stream/StreamBasic';
|
||||
import { ActionExamples } from './examples';
|
||||
export const ActionExamples = {
|
||||
Common: {
|
||||
errors: [
|
||||
{ code: 1400, description: '请求参数错误或业务逻辑执行失败' },
|
||||
{ code: 1401, description: '权限不足' },
|
||||
{ code: 1404, description: '资源不存在' }
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
export class OB11Response {
|
||||
private static createResponse<T> (data: T, status: string, retcode: number, message: string = '', echo: unknown = null, useStream: boolean = false): OB11Return<T> {
|
||||
|
||||
@ -75,4 +75,5 @@ export const GroupActionsExamples = {
|
||||
payload: { group_id: '123456', enable: true },
|
||||
response: null,
|
||||
},
|
||||
|
||||
};
|
||||
@ -1,365 +0,0 @@
|
||||
export const ActionExamples = {
|
||||
GetGroupInfo: {
|
||||
payload: { group_id: '123456789' },
|
||||
return: {
|
||||
group_id: 123456789,
|
||||
group_name: '测试群',
|
||||
member_count: 10,
|
||||
max_member_count: 500,
|
||||
group_all_shut: 0,
|
||||
group_remark: ''
|
||||
}
|
||||
},
|
||||
GetGroupList: {
|
||||
payload: {},
|
||||
return: [
|
||||
{
|
||||
group_id: 123456789,
|
||||
group_name: '测试群',
|
||||
member_count: 10,
|
||||
max_member_count: 500,
|
||||
group_all_shut: 0,
|
||||
group_remark: ''
|
||||
}
|
||||
]
|
||||
},
|
||||
GetGroupMemberList: {
|
||||
payload: { group_id: '123456789' },
|
||||
return: [
|
||||
{
|
||||
group_id: 123456789,
|
||||
user_id: 987654321,
|
||||
nickname: '测试成员',
|
||||
card: '群名片',
|
||||
role: 'member'
|
||||
}
|
||||
]
|
||||
},
|
||||
SendGroupMsg: {
|
||||
payload: { group_id: '123456789', message: 'hello' },
|
||||
return: { message_id: 123456 }
|
||||
},
|
||||
SendLike: {
|
||||
payload: { user_id: '123456789', times: 1 },
|
||||
return: null
|
||||
},
|
||||
GetFriendList: {
|
||||
payload: {},
|
||||
return: [
|
||||
{
|
||||
user_id: 123456789,
|
||||
nickname: '测试好友',
|
||||
remark: '备注'
|
||||
}
|
||||
]
|
||||
},
|
||||
GetStrangerInfo: {
|
||||
payload: { user_id: '123456789' },
|
||||
return: {
|
||||
user_id: 123456789,
|
||||
nickname: '陌生人',
|
||||
sex: 'unknown',
|
||||
age: 0
|
||||
}
|
||||
},
|
||||
SetFriendRemark: {
|
||||
payload: { user_id: '123456789', remark: '新备注' },
|
||||
return: null
|
||||
},
|
||||
GetCookies: {
|
||||
payload: { domain: 'qun.qq.com' },
|
||||
return: { cookies: 'p_skey=xxxx; p_uin=xxxx', bkn: '123456' }
|
||||
},
|
||||
SendPrivateMsg: {
|
||||
payload: { user_id: '123456789', message: 'hello' },
|
||||
return: { message_id: 123456 }
|
||||
},
|
||||
OCRImage: {
|
||||
payload: { image: 'https://example.com/test.jpg' },
|
||||
return: [{ text: '识别文本', confidence: 0.99 }]
|
||||
},
|
||||
GetClientkey: {
|
||||
payload: {},
|
||||
return: { clientkey: 'abcdef123456' }
|
||||
},
|
||||
SetQQAvatar: {
|
||||
payload: { file: 'base64://...' },
|
||||
return: null
|
||||
},
|
||||
SetGroupKickMembers: {
|
||||
payload: { group_id: '123456789', user_id: ['987654321'], reject_add_request: false },
|
||||
return: null
|
||||
},
|
||||
GetLoginInfo: {
|
||||
payload: {},
|
||||
return: { user_id: 123456789, nickname: '机器人' }
|
||||
},
|
||||
GetVersionInfo: {
|
||||
payload: {},
|
||||
return: {
|
||||
app_name: 'NapCatQQ',
|
||||
app_version: '1.0.0',
|
||||
protocol_version: 'v11'
|
||||
}
|
||||
},
|
||||
GetStatus: {
|
||||
payload: {},
|
||||
return: { online: true, good: true }
|
||||
},
|
||||
DeleteMsg: {
|
||||
payload: { message_id: 123456 },
|
||||
return: null
|
||||
},
|
||||
SetGroupWholeBan: {
|
||||
payload: { group_id: '123456789', enable: true },
|
||||
return: null
|
||||
},
|
||||
SetGroupBan: {
|
||||
payload: { group_id: '123456789', user_id: '987654321', duration: 1800 },
|
||||
return: null
|
||||
},
|
||||
SetGroupKick: {
|
||||
payload: { group_id: '123456789', user_id: '987654321', reject_add_request: false },
|
||||
return: null
|
||||
},
|
||||
SetGroupAdmin: {
|
||||
payload: { group_id: '123456789', user_id: '987654321', enable: true },
|
||||
return: null
|
||||
},
|
||||
SetGroupName: {
|
||||
payload: { group_id: '123456789', group_name: '新群名' },
|
||||
return: null
|
||||
},
|
||||
SetGroupCard: {
|
||||
payload: { group_id: '123456789', user_id: '987654321', card: '新名片' },
|
||||
return: null
|
||||
},
|
||||
GetGroupMemberInfo: {
|
||||
payload: { group_id: '123456789', user_id: '987654321' },
|
||||
return: {
|
||||
group_id: 123456789,
|
||||
user_id: 987654321,
|
||||
nickname: '成员昵称',
|
||||
card: '名片',
|
||||
role: 'member'
|
||||
}
|
||||
},
|
||||
SendMsg: {
|
||||
payload: { message_type: 'group', group_id: '123456789', message: 'hello' },
|
||||
return: { message_id: 123456 }
|
||||
},
|
||||
GetMsg: {
|
||||
payload: { message_id: 123456 },
|
||||
return: {
|
||||
time: 123456789,
|
||||
message_type: 'group',
|
||||
message_id: 123456,
|
||||
real_id: 123456,
|
||||
sender: { user_id: 987654321, nickname: '昵称' },
|
||||
message: 'hello'
|
||||
}
|
||||
},
|
||||
SetGroupLeave: {
|
||||
payload: { group_id: '123456789', is_dismiss: false },
|
||||
return: null
|
||||
},
|
||||
CanSendRecord: {
|
||||
payload: {},
|
||||
return: { yes: true }
|
||||
},
|
||||
CanSendImage: {
|
||||
payload: {},
|
||||
return: { yes: true }
|
||||
},
|
||||
SetFriendAddRequest: {
|
||||
payload: { flag: '12345', approve: true, remark: '好友' },
|
||||
return: null
|
||||
},
|
||||
SetGroupAddRequest: {
|
||||
payload: { flag: '12345', sub_type: 'add', approve: true },
|
||||
return: null
|
||||
},
|
||||
DelEssenceMsg: {
|
||||
payload: { message_id: 12345 },
|
||||
return: null
|
||||
},
|
||||
SetEssenceMsg: {
|
||||
payload: { message_id: 12345 },
|
||||
return: null
|
||||
},
|
||||
GetGroupEssence: {
|
||||
payload: { group_id: '123456789' },
|
||||
return: [
|
||||
{
|
||||
msg_seq: 12345,
|
||||
msg_random: 67890,
|
||||
sender_id: 987654321,
|
||||
sender_nick: '发送者',
|
||||
operator_id: 123456789,
|
||||
operator_nick: '操作者',
|
||||
message_id: 123456,
|
||||
operator_time: 1234567890,
|
||||
content: [{ type: 'text', data: { text: '精华消息内容' } }]
|
||||
}
|
||||
]
|
||||
},
|
||||
GetGroupShutList: {
|
||||
payload: { group_id: '123456789' },
|
||||
return: [
|
||||
{
|
||||
user_id: 987654321,
|
||||
nickname: '禁言成员',
|
||||
card: '名片',
|
||||
shut_up_time: 1234567890
|
||||
}
|
||||
]
|
||||
},
|
||||
GetGroupDetailInfo: {
|
||||
payload: { group_id: '123456789' },
|
||||
return: {
|
||||
group_id: 123456789,
|
||||
group_name: '测试群',
|
||||
member_count: 10,
|
||||
max_member_count: 500,
|
||||
group_all_shut: 0,
|
||||
group_remark: ''
|
||||
}
|
||||
},
|
||||
DelGroupNotice: {
|
||||
payload: { group_id: '123456789', notice_id: 'abc-123' },
|
||||
return: null
|
||||
},
|
||||
GetAiRecord: {
|
||||
payload: { group_id: '123456789', character: 'ai' },
|
||||
return: { msg: 'AI回复内容' }
|
||||
},
|
||||
GetGroupNotice: {
|
||||
payload: { group_id: '123456789' },
|
||||
return: [
|
||||
{
|
||||
notice_id: 'abc-123',
|
||||
sender_id: 987654321,
|
||||
publish_time: 1234567890,
|
||||
message: { text: '公告内容', images: [] }
|
||||
}
|
||||
]
|
||||
},
|
||||
SendGroupAiRecord: {
|
||||
payload: { group_id: '123456789', character: 'ai', text: '你好' },
|
||||
return: { message_id: 123456 }
|
||||
},
|
||||
GetFile: {
|
||||
payload: { file: 'abc-123' },
|
||||
return: {
|
||||
file: '/path/to/file',
|
||||
url: 'http://example.com/file',
|
||||
file_size: '1024',
|
||||
file_name: 'test.txt'
|
||||
}
|
||||
},
|
||||
GetImage: {
|
||||
payload: { file: 'abc-123' },
|
||||
return: {
|
||||
file: '/path/to/image.jpg',
|
||||
url: 'http://example.com/image.jpg',
|
||||
file_size: '1024',
|
||||
file_name: 'image.jpg'
|
||||
}
|
||||
},
|
||||
GetRecord: {
|
||||
payload: { file: 'abc-123', out_format: 'mp3' },
|
||||
return: {
|
||||
file: '/path/to/record.mp3',
|
||||
url: 'http://example.com/record.mp3',
|
||||
file_size: '1024',
|
||||
file_name: 'record.mp3',
|
||||
base64: '...'
|
||||
}
|
||||
},
|
||||
GetGroupFileUrl: {
|
||||
payload: { group_id: '123456789', file_id: 'abc-123' },
|
||||
return: { url: 'http://example.com/group_file' }
|
||||
},
|
||||
GetPrivateFileUrl: {
|
||||
payload: { file_id: 'abc-123' },
|
||||
return: { url: 'http://example.com/private_file' }
|
||||
},
|
||||
GetAiCharacters: {
|
||||
payload: { group_id: '123456789' },
|
||||
return: [
|
||||
{
|
||||
type: '常用',
|
||||
characters: [
|
||||
{ character_id: 'ai-1', character_name: 'AI助手', preview_url: 'http://...' }
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
SetOnlineStatus: {
|
||||
payload: { status: 11, ext_status: 0, battery_status: 100 },
|
||||
return: null
|
||||
},
|
||||
SetGroupRemark: {
|
||||
payload: { group_id: '123456789', remark: '群备注' },
|
||||
return: null
|
||||
},
|
||||
GetCollectionList: {
|
||||
payload: { category: '1', count: '10' },
|
||||
return: []
|
||||
},
|
||||
SetSpecialTitle: {
|
||||
payload: { group_id: '123456789', user_id: '987654321', special_title: '群头衔' },
|
||||
return: null
|
||||
},
|
||||
MarkMsgAsRead: {
|
||||
payload: { group_id: '123456789' },
|
||||
return: null
|
||||
},
|
||||
ForwardSingleMsg: {
|
||||
payload: { message_id: 12345, group_id: '123456789' },
|
||||
return: null
|
||||
},
|
||||
SendPoke: {
|
||||
payload: { group_id: '123456789', user_id: '987654321' },
|
||||
return: null
|
||||
},
|
||||
SetGroupTodo: {
|
||||
payload: { group_id: '123456789', message_id: '12345' },
|
||||
return: null
|
||||
},
|
||||
GetCredentials: {
|
||||
payload: { domain: 'qun.qq.com' },
|
||||
return: { cookies: '...', token: 123456 }
|
||||
},
|
||||
GetGroupSystemMsg: {
|
||||
payload: { count: 10 },
|
||||
return: {
|
||||
invited_requests: [],
|
||||
InvitedRequest: [],
|
||||
join_requests: []
|
||||
}
|
||||
},
|
||||
GetRecentContact: {
|
||||
payload: { count: 10 },
|
||||
return: []
|
||||
},
|
||||
GetCSRF: {
|
||||
payload: {},
|
||||
return: { token: 123456789 }
|
||||
},
|
||||
SetMsgEmojiLike: {
|
||||
payload: { message_id: 12345, emoji_id: '124' },
|
||||
return: null
|
||||
},
|
||||
UploadGroupFile: {
|
||||
payload: { group_id: '123456789', file: '/path/to/file', name: 'test.txt' },
|
||||
return: null
|
||||
},
|
||||
Common: {
|
||||
errors: [
|
||||
{ code: 1400, description: '请求参数错误或业务逻辑执行失败' },
|
||||
{ code: 1401, description: '权限不足' },
|
||||
{ code: 1404, description: '资源不存在' }
|
||||
]
|
||||
}
|
||||
};
|
||||
@ -2,7 +2,7 @@ import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { GetPacketStatusDepends } from '@/napcat-onebot/action/packet/GetPacketStatus';
|
||||
import { Type, Static } from '@sinclair/typebox';
|
||||
|
||||
import { ExtendsActionsExamples } from './examples';
|
||||
import { ExtendsActionsExamples } from '../example/ExtendsActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -2,7 +2,7 @@ import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { OneBotAction } from '../OneBotAction';
|
||||
import { Type, Static } from '@sinclair/typebox';
|
||||
|
||||
import { ExtendsActionsExamples } from './examples';
|
||||
import { ExtendsActionsExamples } from '../example/ExtendsActionsExamples';
|
||||
|
||||
const ReturnSchema = Type.Object({
|
||||
clientkey: Type.Optional(Type.String({ description: '客户端Key' })),
|
||||
|
||||
@ -4,7 +4,7 @@ import { checkFileExist, uriToLocalFile } from 'napcat-common/src/file';
|
||||
import fs from 'fs';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ExtendsActionsExamples } from './examples';
|
||||
import { ExtendsActionsExamples } from '../example/ExtendsActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
image: Type.String({ description: '图片路径、URL或Base64' }),
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ExtendsActionsExamples } from './examples';
|
||||
import { ExtendsActionsExamples } from '../example/ExtendsActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ExtendsActionsExamples } from './examples';
|
||||
import { ExtendsActionsExamples } from '../example/ExtendsActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
longNick: Type.String({ description: '签名内容' }),
|
||||
|
||||
@ -4,7 +4,7 @@ import fs from 'node:fs/promises';
|
||||
import { checkFileExist, uriToLocalFile } from 'napcat-common/src/file';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ExtendsActionsExamples } from './examples';
|
||||
import { ExtendsActionsExamples } from '../example/ExtendsActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
file: Type.String({ description: '图片路径、URL或Base64' }),
|
||||
|
||||
@ -2,7 +2,7 @@ import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { GetPacketStatusDepends } from '@/napcat-onebot/action/packet/GetPacketStatus';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ExtendsActionsExamples } from './examples';
|
||||
import { ExtendsActionsExamples } from '../example/ExtendsActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ExtendsActionsExamples } from './examples';
|
||||
import { ExtendsActionsExamples } from '../example/ExtendsActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
words: Type.Array(Type.String(), { description: '待翻译单词列表' }),
|
||||
|
||||
@ -5,7 +5,7 @@ import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { OB11MessageImage, OB11MessageVideo } from '@/napcat-onebot/types';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { FileActionsExamples } from './examples';
|
||||
import { FileActionsExamples } from '../example/FileActionsExamples';
|
||||
|
||||
export const GetFilePayloadSchema = Type.Object({
|
||||
file: Type.Optional(Type.String({ description: '文件路径、URL或Base64' })),
|
||||
|
||||
@ -3,7 +3,7 @@ import { FileNapCatOneBotUUID } from 'napcat-common/src/file-uuid';
|
||||
import { GetPacketStatusDepends } from '@/napcat-onebot/action/packet/GetPacketStatus';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { FileActionsExamples } from './examples';
|
||||
import { FileActionsExamples } from '../example/FileActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { GetFileBase } from './GetFile';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
|
||||
import { FileActionsExamples } from './examples';
|
||||
import { FileActionsExamples } from '../example/FileActionsExamples';
|
||||
|
||||
export default class GetImage extends GetFileBase {
|
||||
override actionName = ActionName.GetImage;
|
||||
|
||||
@ -3,7 +3,7 @@ import { FileNapCatOneBotUUID } from 'napcat-common/src/file-uuid';
|
||||
import { GetPacketStatusDepends } from '@/napcat-onebot/action/packet/GetPacketStatus';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { FileActionsExamples } from './examples';
|
||||
import { FileActionsExamples } from '../example/FileActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
file_id: Type.String({ description: '文件ID' }),
|
||||
|
||||
@ -4,7 +4,7 @@ import { promises as fs } from 'fs';
|
||||
import { FFmpegService } from '@/napcat-core/helper/ffmpeg/ffmpeg';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { FileActionsExamples } from './examples';
|
||||
import { FileActionsExamples } from '../example/FileActionsExamples';
|
||||
|
||||
const out_format_list = ['mp3', 'amr', 'wma', 'm4a', 'spx', 'ogg', 'wav', 'flac'];
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { FileNapCatOneBotUUID } from 'napcat-common/src/file-uuid';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -5,7 +5,7 @@ import { join as joinPath } from 'node:path';
|
||||
import { calculateFileMD5, uriToLocalFile } from 'napcat-common/src/file';
|
||||
import { randomUUID } from 'crypto';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
url: Type.Optional(Type.String({ description: '下载链接' })),
|
||||
|
||||
@ -5,7 +5,7 @@ import { MessageUnique } from 'napcat-common/src/message-unique';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { ChatType, ElementType, MsgSourceType, NTMsgType, RawMessage } from 'napcat-core';
|
||||
import { isNumeric } from 'napcat-common/src/helper';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
message_id: Type.Optional(Type.String({ description: '消息ID' })),
|
||||
|
||||
@ -6,7 +6,7 @@ import { MessageUnique } from 'napcat-common/src/message-unique';
|
||||
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { NetworkAdapterConfig } from '@/napcat-onebot/config/config';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
user_id: Type.String({ description: '用户QQ' }),
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { OB11Construct } from '@/napcat-onebot/helper/data';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { WebHonorType } from 'napcat-core/types';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -5,7 +5,7 @@ import { ChatType, Peer } from 'napcat-core/types';
|
||||
import { MessageUnique } from 'napcat-common/src/message-unique';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { NetworkAdapterConfig } from '@/napcat-onebot/config/config';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { OB11Construct } from '@/napcat-onebot/helper/data';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { sleep } from 'napcat-common/src/helper';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({}, { description: '在线客户端负载' });
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import { OB11Construct } from '@/napcat-onebot/helper/data';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { calcQQLevel } from 'napcat-common/src/helper';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
user_id: Type.String({ description: '用户QQ' }),
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
export const GoCQHTTPCheckUrlSafelyPayloadSchema = Type.Object({
|
||||
url: Type.String({ description: '要检查的 URL' }),
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
export const GoCQHTTPDeleteFriendPayloadSchema = Type.Object({
|
||||
friend_id: Type.Optional(Type.Union([Type.String(), Type.Number()], { description: '好友 QQ 号' })),
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
export const GoCQHTTPGetModelShowPayloadSchema = Type.Object({
|
||||
model: Type.Optional(Type.String({ description: '模型名称' })),
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
// 兼容性代码
|
||||
export class GoCQHTTPSetModelShow extends OneBotAction<void, void> {
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { QuickAction, QuickActionEvent } from '@/napcat-onebot/types';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
const SenderSchema = Type.Object({
|
||||
user_id: Type.String({ description: '用户ID' }),
|
||||
|
||||
@ -3,7 +3,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { unlink } from 'node:fs/promises';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
export const SendGroupNoticePayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -3,7 +3,7 @@ import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { checkFileExistV2, uriToLocalFile } from 'napcat-common/src/file';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import fs from 'node:fs/promises';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
export const SetGroupPortraitPayloadSchema = Type.Object({
|
||||
file: Type.String({ description: '头像文件路径或 URL' }),
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
export const SetQQProfilePayloadSchema = Type.Object({
|
||||
nickname: Type.String({ description: '昵称' }),
|
||||
|
||||
@ -5,7 +5,7 @@ import fs from 'fs';
|
||||
import { uriToLocalFile } from 'napcat-common/src/file';
|
||||
import { SendMessageContext } from '@/napcat-onebot/api';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
export const GoCQHTTPUploadGroupFilePayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -6,7 +6,7 @@ import { uriToLocalFile } from 'napcat-common/src/file';
|
||||
import { SendMessageContext } from '@/napcat-onebot/api';
|
||||
import { ContextMode, createContext } from '@/napcat-onebot/action/msg/SendMsg';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
export const GoCQHTTPUploadPrivateFilePayloadSchema = Type.Object({
|
||||
user_id: Type.String({ description: '用户 QQ' }),
|
||||
|
||||
@ -3,7 +3,7 @@ import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { MessageUnique } from 'napcat-common/src/message-unique';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { GroupActionsExamples } from './examples';
|
||||
import { GroupActionsExamples } from '../example/GroupActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
message_id: Type.Optional(Type.Union([Type.Number(), Type.String()], { description: '消息ID' })),
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { GroupActionsExamples } from './examples';
|
||||
import { GroupActionsExamples } from '../example/GroupActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { GroupActionsExamples } from './examples';
|
||||
import { GroupActionsExamples } from '../example/GroupActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -7,7 +7,7 @@ import { Static, Type } from '@sinclair/typebox';
|
||||
import { NetworkAdapterConfig } from '@/napcat-onebot/config/config';
|
||||
import { OB11MessageData, OB11MessageDataType } from '@/napcat-onebot/types';
|
||||
|
||||
import { GroupActionsExamples } from './examples';
|
||||
import { GroupActionsExamples } from '../example/GroupActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -4,7 +4,7 @@ import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { OB11GroupSchema } from '../schemas';
|
||||
|
||||
import { GroupActionsExamples } from './examples';
|
||||
import { GroupActionsExamples } from '../example/GroupActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -3,8 +3,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { OB11GroupSchema } from '../schemas';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
import { GroupActionsExamples } from '@/napcat-onebot/action/example/GroupActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
no_cache: Type.Optional(Type.Union([Type.Boolean(), Type.String()], { description: '是否不使用缓存' })),
|
||||
@ -23,8 +22,8 @@ class GetGroupList extends OneBotAction<PayloadType, ReturnType> {
|
||||
override actionSummary = '获取群列表';
|
||||
override actionDescription = '获取当前帐号的群聊列表';
|
||||
override actionTags = ['群组接口'];
|
||||
override payloadExample = ActionExamples.GetGroupList.payload;
|
||||
override returnExample = ActionExamples.GetGroupList.return;
|
||||
override payloadExample = GroupActionsExamples.GetGroupList.payload;
|
||||
override returnExample = GroupActionsExamples.GetGroupList.response;
|
||||
|
||||
async _handle (payload: PayloadType) {
|
||||
return OB11Construct.groups(
|
||||
|
||||
@ -4,7 +4,7 @@ import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { OB11GroupMemberSchema } from '../schemas';
|
||||
|
||||
import { GroupActionsExamples } from './examples';
|
||||
import { GroupActionsExamples } from '../example/GroupActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -3,7 +3,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GroupMember } from 'napcat-core';
|
||||
import { GroupActionsExamples } from './examples';
|
||||
import { GroupActionsExamples } from '../example/GroupActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -2,7 +2,7 @@ import { WebApiGroupNoticeFeed } from 'napcat-core';
|
||||
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { GroupActionsExamples } from './examples';
|
||||
import { GroupActionsExamples } from '../example/GroupActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { ContextMode, ReturnDataType, SendMsgBase, SendMsgPayload } from '@/napcat-onebot/action/msg/SendMsg';
|
||||
import { ActionName, BaseCheckResult } from '@/napcat-onebot/action/router';
|
||||
|
||||
import { GroupActionsExamples } from './examples';
|
||||
import { GroupActionsExamples } from '../example/GroupActionsExamples';
|
||||
|
||||
// 未检测参数
|
||||
class SendGroupMsg extends SendMsgBase {
|
||||
|
||||
@ -3,7 +3,7 @@ import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { MessageUnique } from 'napcat-common/src/message-unique';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { GroupActionsExamples } from './examples';
|
||||
import { GroupActionsExamples } from '../example/GroupActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
message_id: Type.Union([Type.Number(), Type.String()], { description: '消息ID' }),
|
||||
|
||||
@ -3,7 +3,7 @@ import { GroupNotify, NTGroupRequestOperateTypes } from 'napcat-core/types';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { GroupActionsExamples } from './examples';
|
||||
import { GroupActionsExamples } from '../example/GroupActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
flag: Type.String({ description: '请求flag' }),
|
||||
|
||||
@ -3,7 +3,7 @@ import { NTGroupMemberRole } from 'napcat-core/types';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { GroupActionsExamples } from './examples';
|
||||
import { GroupActionsExamples } from '../example/GroupActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { GroupActionsExamples } from './examples';
|
||||
import { GroupActionsExamples } from '../example/GroupActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { GroupActionsExamples } from './examples';
|
||||
import { GroupActionsExamples } from '../example/GroupActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { GroupActionsExamples } from './examples';
|
||||
import { GroupActionsExamples } from '../example/GroupActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { GroupActionsExamples } from './examples';
|
||||
import { GroupActionsExamples } from '../example/GroupActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { GroupActionsExamples } from './examples';
|
||||
import { GroupActionsExamples } from '../example/GroupActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { GroupActionsExamples } from './examples';
|
||||
import { GroupActionsExamples } from '../example/GroupActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
|
||||
import { Type } from '@sinclair/typebox';
|
||||
import { GuildActionsExamples } from './examples';
|
||||
import { GuildActionsExamples } from '../example/GuildActionsExamples';
|
||||
|
||||
export class GetGuildList extends OneBotAction<void, void> {
|
||||
override actionName = ActionName.GetGuildList;
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
|
||||
import { Type } from '@sinclair/typebox';
|
||||
import { GuildActionsExamples } from './examples';
|
||||
import { GuildActionsExamples } from '../example/GuildActionsExamples';
|
||||
|
||||
export class GetGuildProfile extends OneBotAction<void, void> {
|
||||
override actionName = ActionName.GetGuildProfile;
|
||||
|
||||
@ -15,8 +15,7 @@ import { stringifyWithBigInt } from 'napcat-common/src/helper';
|
||||
import { PacketMsg } from 'napcat-core/packet/message/message';
|
||||
import { rawMsgWithSendMsg } from 'napcat-core/packet/message/converter';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
import { MsgActionsExamples } from '@/napcat-onebot/action/msg/examples';
|
||||
|
||||
export const SendMsgPayloadSchema = Type.Object({
|
||||
message_type: Type.Optional(Type.Union([Type.Literal('private'), Type.Literal('group')], { description: '消息类型 (private/group)' })),
|
||||
@ -448,6 +447,6 @@ export default class SendMsg extends SendMsgBase {
|
||||
override actionSummary = '发送消息';
|
||||
override actionDescription = '发送私聊或群聊消息';
|
||||
override actionTags = ['消息接口'];
|
||||
override payloadExample = ActionExamples.SendMsg.payload;
|
||||
override returnExample = ActionExamples.SendMsg.return;
|
||||
override payloadExample = MsgActionsExamples.SendMsg.payload;
|
||||
override returnExample = MsgActionsExamples.SendMsg.response;
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { NewActionsExamples } from './examples';
|
||||
import { NewActionsExamples } from '../example/NewActionsExamples';
|
||||
|
||||
export const GetDoubtFriendsAddRequestPayloadSchema = Type.Object({
|
||||
count: Type.Number({ default: 50, description: '获取数量' }),
|
||||
|
||||
@ -2,7 +2,7 @@ import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { GetPacketStatusDepends } from '@/napcat-onebot/action/packet/GetPacketStatus';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { PacketActionsExamples } from './examples';
|
||||
import { PacketActionsExamples } from '../example/PacketActionsExamples';
|
||||
|
||||
export const SendPokePayloadSchema = Type.Object({
|
||||
group_id: Type.Optional(Type.String({ description: '群号' })),
|
||||
|
||||
@ -4,7 +4,7 @@ import { GetPacketStatusDepends } from '@/napcat-onebot/action/packet/GetPacketS
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { ActionName } from '../router';
|
||||
|
||||
import { PacketActionsExamples } from './examples';
|
||||
import { PacketActionsExamples } from '../example/PacketActionsExamples';
|
||||
|
||||
export const SetGroupTodoPayloadSchema = Type.Object({
|
||||
group_id: Type.Union([Type.String(), Type.Number()], { description: '群号' }),
|
||||
|
||||
@ -4,8 +4,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { OB11UserSchema } from '../schemas';
|
||||
import { Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
import { SystemActionsExamples } from '@/napcat-onebot/action/example/SystemActionsExamples';
|
||||
|
||||
class GetLoginInfo extends OneBotAction<void, OB11User> {
|
||||
override actionName = ActionName.GetLoginInfo;
|
||||
@ -14,8 +13,8 @@ class GetLoginInfo extends OneBotAction<void, OB11User> {
|
||||
override actionSummary = '获取登录号信息';
|
||||
override actionDescription = '获取当前登录帐号的信息';
|
||||
override actionTags = ['系统接口'];
|
||||
override payloadExample = ActionExamples.GetLoginInfo.payload;
|
||||
override returnExample = ActionExamples.GetLoginInfo.return;
|
||||
override payloadExample = SystemActionsExamples.GetLoginInfo.payload;
|
||||
override returnExample = SystemActionsExamples.GetLoginInfo.response;
|
||||
|
||||
async _handle () {
|
||||
return OB11Construct.selfInfo(this.core.selfInfo);
|
||||
|
||||
@ -3,8 +3,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { OB11UserSchema } from '../schemas';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
import { UserActionsExamples } from '@/napcat-onebot/action/example/UserActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
no_cache: Type.Optional(Type.Union([Type.Boolean(), Type.String()], { description: '是否不使用缓存' })),
|
||||
@ -23,8 +22,8 @@ export default class GetFriendList extends OneBotAction<PayloadType, ReturnType>
|
||||
override actionSummary = '获取好友列表';
|
||||
override actionDescription = '获取当前帐号的好友列表';
|
||||
override actionTags = ['用户接口'];
|
||||
override payloadExample = ActionExamples.GetFriendList.payload;
|
||||
override returnExample = ActionExamples.GetFriendList.return;
|
||||
override payloadExample = UserActionsExamples.GetFriendList.payload;
|
||||
override returnExample = UserActionsExamples.GetFriendList.response;
|
||||
|
||||
async _handle (_payload: PayloadType) {
|
||||
const buddyMap = await this.core.apis.FriendApi.getBuddyV2SimpleInfoMap();
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
|
||||
export const SendLikePayloadSchema = Type.Object({
|
||||
user_id: Type.String({ description: '对方 QQ 号' }),
|
||||
times: Type.Union([Type.Number(), Type.String()], { default: 1, description: '点赞次数' }),
|
||||
@ -24,7 +21,6 @@ export default class SendLike extends OneBotAction<SendLikePayload, void> {
|
||||
};
|
||||
override returnExample = {};
|
||||
override errorExamples = [
|
||||
...ActionExamples.Common.errors,
|
||||
{ code: 1400, description: '点赞失败(频率过快或用户不存在)' }
|
||||
];
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
|
||||
export const SetFriendRemarkPayloadSchema = Type.Object({
|
||||
user_id: Type.String({ description: '对方 QQ 号' }),
|
||||
@ -24,7 +23,6 @@ export default class SetFriendRemark extends OneBotAction<SetFriendRemarkPayload
|
||||
};
|
||||
override returnExample = null;
|
||||
override errorExamples = [
|
||||
...ActionExamples.Common.errors,
|
||||
{ code: 1400, description: '备注设置失败(好友不存在或非法输入)' }
|
||||
];
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user