chore: run eslint --fix in onebot module

This commit is contained in:
Wesley F. Young
2024-08-09 20:35:03 +08:00
parent f5b6fa31a7
commit af01a073ef
110 changed files with 3832 additions and 3829 deletions

View File

@@ -5,48 +5,48 @@ import { MessageUnique } from '@/common/utils/MessageUnique';
import { NodeIKernelMsgListener } from '@/core';
const SchemaData = {
type: 'object',
properties: {
message_id: {
oneOf: [
{ type: 'number' },
{ type: 'string' }
]
}
},
required: ['message_id']
type: 'object',
properties: {
message_id: {
oneOf: [
{ type: 'number' },
{ type: 'string' }
]
}
},
required: ['message_id']
} as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>;
class DeleteMsg extends BaseAction<Payload, void> {
actionName = ActionName.DeleteMsg;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload) {
const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi;
const msg = MessageUnique.getMsgIdAndPeerByShortId(Number(payload.message_id));
if (msg) {
let ret = this.CoreContext.eventWrapper.RegisterListen<NodeIKernelMsgListener['onMsgInfoListUpdate']>
(
'NodeIKernelMsgListener/onMsgInfoListUpdate',
1,
5000,
(msgs) => {
if (msgs.find(m => m.msgId === msg.MsgId && m.recallTime !== '0')) {
return true;
actionName = ActionName.DeleteMsg;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload) {
const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi;
const msg = MessageUnique.getMsgIdAndPeerByShortId(Number(payload.message_id));
if (msg) {
const ret = this.CoreContext.eventWrapper.RegisterListen<NodeIKernelMsgListener['onMsgInfoListUpdate']>
(
'NodeIKernelMsgListener/onMsgInfoListUpdate',
1,
5000,
(msgs) => {
if (msgs.find(m => m.msgId === msg.MsgId && m.recallTime !== '0')) {
return true;
}
return false;
}
).catch(e => new Promise<undefined>((resolve, reject) => { resolve(undefined); }));
await NTQQMsgApi.recallMsg(msg.Peer, [msg.MsgId]);
const data = await ret;
if (!data) {
throw new Error('Recall failed');
}
return false;
}
).catch(e => new Promise<undefined>((resolve, reject) => { resolve(undefined) }));
await NTQQMsgApi.recallMsg(msg.Peer, [msg.MsgId]);
let data = await ret;
if (!data) {
throw new Error('Recall failed');
}
//await sleep(100);
//await NTQQMsgApi.getMsgsByMsgId(msg.Peer, [msg.MsgId]);
//await sleep(100);
//await NTQQMsgApi.getMsgsByMsgId(msg.Peer, [msg.MsgId]);
}
}
}
}
export default DeleteMsg;