From 22ad48e9beb1da9bae555de63c7946d3dfbf1733 Mon Sep 17 00:00:00 2001 From: adriano Date: Tue, 15 Aug 2023 13:59:25 -0300 Subject: [PATCH] =?UTF-8?q?Corre=C3=A7=C3=A3o=20de=20propriedade=20null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/helpers/TicketConfig.ts | 3 +-- backend/src/services/WbotServices/wbotMessageListener.ts | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/backend/src/helpers/TicketConfig.ts b/backend/src/helpers/TicketConfig.ts index 830646a..00a7f1b 100644 --- a/backend/src/helpers/TicketConfig.ts +++ b/backend/src/helpers/TicketConfig.ts @@ -104,8 +104,7 @@ const isWeekend = async () => { else{ // obj.set = true; // obj.msg = weekend.message; - } - + } return obj; } }; diff --git a/backend/src/services/WbotServices/wbotMessageListener.ts b/backend/src/services/WbotServices/wbotMessageListener.ts index b7b0d7a..3620d14 100644 --- a/backend/src/services/WbotServices/wbotMessageListener.ts +++ b/backend/src/services/WbotServices/wbotMessageListener.ts @@ -632,7 +632,7 @@ const handleMessage = async (msg: any, wbot: any): Promise => { // MESSAGE TO HOLIDAY const holiday: any = await isHoliday(); - if (holiday.set) { + if (holiday && holiday.set) { if (msg.fromMe && holiday.msg == msg.body) { console.log("HOLIDAY MESSAGE IGNORED"); return; @@ -643,9 +643,9 @@ const handleMessage = async (msg: any, wbot: any): Promise => { } // MESSAGES TO SATURDAY OR SUNDAY - const weekend: any = await isWeekend(); + const weekend: any = await isWeekend(); - if (weekend.set) { + if (weekend && weekend.set) { if (msg.fromMe && weekend.msg == msg.body) { console.log("WEEKEND MESSAGE IGNORED"); return; @@ -658,7 +658,7 @@ const handleMessage = async (msg: any, wbot: any): Promise => { // MESSAGE TO BUSINESS TIME const businessTime = await isOutBusinessTime(); - if (businessTime.set) { + if (businessTime && businessTime.set) { if (msg.fromMe && businessTime.msg == msg.body) { console.log("BUSINESS TIME MESSAGE IGNORED"); return;