update: move to recallMsg(V2)

This commit is contained in:
Wesley F. Young committed 2024-09-07 23:28:35 +08:00
1 parent 137608c3d2
commit 6d2d6b521b
2 files changed
+2 -17

No files matched your search

+1 -9
View File
@@ -25,15 +25,7 @@ class DeleteMsg extends BaseAction<Payload, void> {
async _handle(payload: Payload) {
const msg = MessageUnique.getMsgIdAndPeerByShortId(Number(payload.message_id));
if (msg) {
const ret = this.core.eventWrapper.registerListen(
'NodeIKernelMsgListener/onMsgInfoListUpdate',
1,
1000,
(msgs) => !!msgs.find(m => m.msgId === msg.MsgId && m.recallTime !== '0'),
).catch(() => undefined);
await this.core.apis.MsgApi.recallMsg(msg.Peer, [msg.MsgId]);
const data = await ret;
if (!data) throw new Error('Recall failed');
await this.core.apis.MsgApi.recallMsg(msg.Peer, msg.MsgId);
} else {
throw new Error('Recall failed');
}