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;