Skip to content

Commit

Permalink
Correção exibição msg apagada
Browse files Browse the repository at this point in the history
  • Loading branch information
rtenorioh committed Mar 6, 2023
1 parent 491c42f commit ccd3c49
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions backend/src/services/WbotServices/wbotMessageListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,15 @@ const verifyQuotedMessage = async (
return quotedMsg;
};

const verifyRevoked = async (msgBody: string | undefined): Promise<void> => {
const verifyRevoked = async (msgBody?: string): Promise<void> => {
await new Promise(r => setTimeout(r, 500));

const io = getIO();

if (msgBody === undefined) {
return;
}

try {
const message = await Message.findOne({
where: {
Expand Down Expand Up @@ -603,8 +607,10 @@ const wbotMessageListener = async (wbot: Session): Promise<void> => {
});

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 || "");
}
});
};

Expand Down

0 comments on commit ccd3c49

Please sign in to comment.