From ccd3c49ff6c213782a00ee40e64decb7cc2e63d2 Mon Sep 17 00:00:00 2001 From: Robson Tenorio Date: Sun, 5 Mar 2023 21:47:52 -0300 Subject: [PATCH] =?UTF-8?q?Corre=C3=A7=C3=A3o=20exibi=C3=A7=C3=A3o=20msg?= =?UTF-8?q?=20apagada?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/services/WbotServices/wbotMessageListener.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/backend/src/services/WbotServices/wbotMessageListener.ts b/backend/src/services/WbotServices/wbotMessageListener.ts index 00ece331..71a73be7 100644 --- a/backend/src/services/WbotServices/wbotMessageListener.ts +++ b/backend/src/services/WbotServices/wbotMessageListener.ts @@ -66,11 +66,15 @@ const verifyQuotedMessage = async ( return quotedMsg; }; -const verifyRevoked = async (msgBody: string | undefined): Promise => { +const verifyRevoked = async (msgBody?: string): Promise => { await new Promise(r => setTimeout(r, 500)); const io = getIO(); + if (msgBody === undefined) { + return; + } + try { const message = await Message.findOne({ where: { @@ -603,8 +607,10 @@ const wbotMessageListener = async (wbot: Session): Promise => { }); wbot.on("message_revoke_everyone", async (after, before) => { - const msgBody = before?.body; - verifyRevoked(msgBody); + const msgBody: string | undefined = before?.body; + if (msgBody !== undefined) { + verifyRevoked(msgBody || ""); + } }); };