chore: run eslint --fix in onebot module

This commit is contained in:
Wesley F. Young committed 2024-08-09 20:35:03 +08:00
1 parent 714f8327ea
commit 5990e0c2eb
110 files changed
+3830 -3827

No files matched your search

+31 -31
View File
@@ -16,11 +16,11 @@ interface GroupNotice {
}
const SchemaData = {
type: 'object',
properties: {
group_id: { type: [ 'number' , 'string' ] },
},
required: ['group_id']
type: 'object',
properties: {
group_id: { type: [ 'number' , 'string' ] },
},
required: ['group_id']
} as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>;
@@ -28,33 +28,33 @@ type Payload = FromSchema<typeof SchemaData>;
type ApiGroupNotice = GroupNotice & WebApiGroupNoticeFeed;
export class GetGroupNotice extends BaseAction<Payload, GroupNotice[]> {
actionName = ActionName.GoCQHTTP_GetGroupNotice;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload) {
const NTQQWebApi = this.CoreContext.getApiContext().WebApi;
actionName = ActionName.GoCQHTTP_GetGroupNotice;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload) {
const NTQQWebApi = this.CoreContext.getApiContext().WebApi;
const group = payload.group_id.toString();
const ret = await NTQQWebApi.getGroupNotice(group);
if (!ret) {
throw new Error('获取公告失败');
}
const retNotices: GroupNotice[] = new Array<ApiGroupNotice>();
for (const key in ret.feeds) {
const retApiNotice: WebApiGroupNoticeFeed = ret.feeds[key];
const retNotice: GroupNotice = {
// ...ret.feeds[key],
sender_id: retApiNotice.u,
publish_time: retApiNotice.pubt,
message: {
text: retApiNotice.msg.text,
image: retApiNotice.msg.pics?.map((pic) => {
return { id: pic.id, height: pic.h, width: pic.w };
}) || []
const group = payload.group_id.toString();
const ret = await NTQQWebApi.getGroupNotice(group);
if (!ret) {
throw new Error('获取公告失败');
}
const retNotices: GroupNotice[] = new Array<ApiGroupNotice>();
for (const key in ret.feeds) {
const retApiNotice: WebApiGroupNoticeFeed = ret.feeds[key];
const retNotice: GroupNotice = {
// ...ret.feeds[key],
sender_id: retApiNotice.u,
publish_time: retApiNotice.pubt,
message: {
text: retApiNotice.msg.text,
image: retApiNotice.msg.pics?.map((pic) => {
return { id: pic.id, height: pic.h, width: pic.w };
}) || []
}
};
retNotices.push(retNotice);
}
};
retNotices.push(retNotice);
}
return retNotices;
}
return retNotices;
}
}