Apply formatting and minor style fixes across repo

Normalize code style across multiple packages: whitespace cleanup, consistent commas and trailing commas in arrays/enums/objects, fix table markdown lines in CI comment template, ensure newline at EOF, normalize header/object property quoting and spacing, remove stray blank lines and minor non-functional comment tweaks. These are formatting-only changes and small type/annotation spacing adjustments; no functional behavior changes intended.
This commit is contained in:
手瓜一十雪 committed 2026-03-05 18:45:50 +08:00
1 parent d2d0b258bc
commit 974528fe7e
186 files changed
+1367 -1233

No files matched your search

@@ -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,
@@ -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) {
@@ -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;
@@ -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: '评论结果' });
@@ -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);
}
}
@@ -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;
@@ -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) {
@@ -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
@@ -28,8 +28,8 @@ export class GetFriendWithCategory extends OneBotAction<void, ReturnType> {
categoryId: 1,
categoryName: '我的好友',
categoryMbCount: 1,
buddyList: []
}
buddyList: [],
},
];
async _handle () {
@@ -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> {
@@ -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;
@@ -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;
@@ -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 = {
@@ -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> {
@@ -2,7 +2,6 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
import { ActionName } from '@/napcat-onebot/action/router';
import { Static, Type } from '@sinclair/typebox';
const PayloadSchema = Type.Object({
group_id: Type.String({ description: '群号' }),
attach_info: Type.String({ default: '', description: '附加信息(用于分页,从上一次返回结果中获取)' }),
@@ -26,18 +25,20 @@ export class GetQunAlbumList extends OneBotAction<PayloadType, GetQunAlbumListRe
group_id: '123456',
attach_info: '',
};
override returnExample = {
album_list: [
{
album_id: 'album_1',
album_name: '测试相册',
cover_url: 'http://example.com/cover.jpg',
create_time: 1734567890
}
create_time: 1734567890,
},
],
attach_info: '',
has_more: false,
};
override payloadSchema = PayloadSchema;
override returnSchema = ReturnSchema;
@@ -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 () {
@@ -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;
@@ -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> {
@@ -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) {
@@ -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;
@@ -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;
@@ -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) {
@@ -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(
@@ -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;
@@ -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;
@@ -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> {
@@ -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;
@@ -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;
@@ -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) {
@@ -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) {
@@ -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;
}
\`\`\`
`;
`;
@@ -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;
}
}
@@ -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;
@@ -32,7 +32,7 @@ export class TranslateEnWordToZn extends OneBotAction<PayloadType, ReturnType> {
throw new Error('翻译失败');
}
return {
words: ret.words
words: ret.words,
};
}
}
@@ -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;