chore: run a full eslint

This commit is contained in:
Wesley F. Young
2024-08-10 19:58:31 +08:00
parent 9a9511aad6
commit 116a04e081
198 changed files with 8187 additions and 7744 deletions

View File

@@ -1,17 +1,18 @@
import BaseAction from '../BaseAction';
import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
interface Response {
cookies: string,
bkn: string
cookies: string,
bkn: string
}
const SchemaData = {
type: 'object',
properties: {
domain: { type: 'string' }
domain: { type: 'string' },
},
required: ['domain']
required: ['domain'],
} as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>;
@@ -19,6 +20,7 @@ type Payload = FromSchema<typeof SchemaData>;
export class GetCookies extends BaseAction<Payload, Response> {
actionName = ActionName.GetCookies;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload) {
const NTQQUserApi = this.CoreContext.getApiContext().UserApi;
const NTQQWebApi = this.CoreContext.getApiContext().WebApi;

View File

@@ -9,13 +9,14 @@ const SchemaData = {
type: 'object',
properties: {
no_cache: { type: ['boolean', 'string'] },
}
},
} as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>;
export default class GetFriendList extends BaseAction<Payload, OB11User[]> {
actionName = ActionName.GetFriendList;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload) {
//全新逻辑
const NTQQFriendApi = this.CoreContext.getApiContext().FriendApi;

View File

@@ -1,4 +1,3 @@
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import BaseAction from '../BaseAction';
import { ActionName } from '../types';
@@ -7,8 +6,8 @@ import { OB11Constructor } from '@/onebot/helper/data';
const SchemaData = {
type: 'object',
properties: {
count: { type: ['number', 'string'] }
}
count: { type: ['number', 'string'] },
},
} as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>;
@@ -16,6 +15,7 @@ type Payload = FromSchema<typeof SchemaData>;
export default class GetRecentContact extends BaseAction<Payload, any> {
actionName = ActionName.GetRecentContact;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload) {
const NTQQUserApi = this.CoreContext.getApiContext().UserApi;
const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi;
@@ -24,7 +24,7 @@ export default class GetRecentContact extends BaseAction<Payload, any> {
const FastMsg = await NTQQMsgApi.getMsgsByMsgId({ chatType: t.chatType, peerUid: t.peerUid }, [t.msgId]);
if (FastMsg.msgList.length > 0) {
//扩展ret.info.changedList
const lastestMsg = await OB11Constructor.message(this.CoreContext, FastMsg.msgList[0], "array");
const lastestMsg = await OB11Constructor.message(this.CoreContext, FastMsg.msgList[0], 'array');
return {
lastestMsg: lastestMsg,
peerUin: t.peerUin,
@@ -34,7 +34,7 @@ export default class GetRecentContact extends BaseAction<Payload, any> {
msgId: t.msgId,
sendNickName: t.sendNickName,
sendMemberName: t.sendMemberName,
peerName: t.peerName
peerName: t.peerName,
};
}
return {
@@ -45,7 +45,7 @@ export default class GetRecentContact extends BaseAction<Payload, any> {
msgId: t.msgId,
sendNickName: t.sendNickName,
sendMemberName: t.sendMemberName,
peerName: t.peerName
peerName: t.peerName,
};
}));
return data;

View File

@@ -1,4 +1,3 @@
import BaseAction from '../BaseAction';
import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
@@ -7,9 +6,9 @@ const SchemaData = {
type: 'object',
properties: {
user_id: { type: ['number', 'string'] },
times: { type: ['number', 'string'] }
times: { type: ['number', 'string'] },
},
required: ['user_id', 'times']
required: ['user_id', 'times'],
} as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>;
@@ -17,6 +16,7 @@ type Payload = FromSchema<typeof SchemaData>;
export default class SendLike extends BaseAction<Payload, null> {
actionName = ActionName.SendLike;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload): Promise<null> {
const NTQQUserApi = this.CoreContext.getApiContext().UserApi;
//logDebug('点赞参数', payload);

View File

@@ -1,16 +1,15 @@
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import BaseAction from '../BaseAction';
import { ActionName } from '../types';
import { NTQQFriendApi } from '@/core/apis/friend';
const SchemaData = {
type: 'object',
properties: {
flag: { type: 'string' },
approve: { type: ['string', 'boolean'] },
remark: { type: 'string' }
remark: { type: 'string' },
},
required: ['flag']
required: ['flag'],
} as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>;
@@ -18,6 +17,7 @@ type Payload = FromSchema<typeof SchemaData>;
export default class SetFriendAddRequest extends BaseAction<Payload, null> {
actionName = ActionName.SetFriendAddRequest;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload): Promise<null> {
const NTQQFriendApi = this.CoreContext.getApiContext().FriendApi;
const approve = payload.approve?.toString() !== 'false';