From b1e0fce5048c51a1c15b20d0e03845190d04d971 Mon Sep 17 00:00:00 2001 From: blox <73058244+soudblox@users.noreply.github.com> Date: Mon, 19 Sep 2022 02:33:43 +0700 Subject: [PATCH] Allow the deletion of others' messages (#1688) --- src/structures/Message.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index dc4acaf..e8260dd 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -430,14 +430,14 @@ class Message extends Base { /** * Deletes a message from the chat - * @param {?boolean} everyone If true and the message is sent by the current user, will delete it for everyone in the chat. + * @param {?boolean} everyone If true and the message is sent by the current user or the user is an admin, will delete it for everyone in the chat. */ async delete(everyone) { await this.client.pupPage.evaluate((msgId, everyone) => { let msg = window.Store.Msg.get(msgId); - if (everyone && msg.id.fromMe && msg._canRevoke()) { - return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], {type: 'Sender'}); + if (everyone && msg._canRevoke()) { + return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], { type: msg.id.fromMe ? 'Sender' : 'Admin' }); } return window.Store.Cmd.sendDeleteMsgs(msg.chat, [msg], true);