From 7d91e05a69597fc3318110443ac3f309821cf8d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Mon, 2 Sep 2024 16:31:18 +0800 Subject: [PATCH] fix: #332 --- src/onebot/action/msg/DeleteMsg.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/onebot/action/msg/DeleteMsg.ts b/src/onebot/action/msg/DeleteMsg.ts index 2c7e5678..b95004cb 100644 --- a/src/onebot/action/msg/DeleteMsg.ts +++ b/src/onebot/action/msg/DeleteMsg.ts @@ -28,18 +28,14 @@ class DeleteMsg extends BaseAction { const ret = this.core.eventWrapper.registerListen( 'NodeIKernelMsgListener/onMsgInfoListUpdate', 1, - 5000, + 1000, (msgs) => !!msgs.find(m => m.msgId === msg.MsgId && m.recallTime !== '0'), - ).catch(() => new Promise((resolve) => { - resolve(undefined); - })); + ).catch(() => undefined); await this.core.apis.MsgApi.recallMsg(msg.Peer, [msg.MsgId]); const data = await ret; - if (!data) { - //throw new Error('Recall failed'); - } - //await sleep(100); - //await NTQQMsgApi.getMsgsByMsgId(msg.Peer, [msg.MsgId]); + if (!data) throw new Error('Recall failed'); + } else { + throw new Error('Recall failed'); } } }