mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
update: move to recallMsg(V2)
This commit is contained in:
parent
264cb6bbd2
commit
4672930037
@ -157,14 +157,7 @@ export class NTQQMsgApi {
|
||||
return this.context.session.getMsgService().getMsgsIncludeSelf(peer, msgId, count, isReverseOrder);
|
||||
}
|
||||
|
||||
async recallMsg(peer: Peer, msgIds: string[]) {
|
||||
await this.context.session.getMsgService().recallMsg({
|
||||
chatType: peer.chatType,
|
||||
peerUid: peer.peerUid,
|
||||
}, msgIds);
|
||||
}
|
||||
|
||||
async recallMsgV2(peer: Peer, msgId: string) {
|
||||
async recallMsg(peer: Peer, msgId: string) {
|
||||
await this.core.eventWrapper.callNormalEventV2(
|
||||
'NodeIKernelMsgService/recallMsg',
|
||||
'NodeIKernelMsgListener/onMsgInfoListUpdate',
|
||||
|
@ -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');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user