Correção de propriedade null

pull/21/head
adriano 2023-08-15 13:59:25 -03:00
parent 2138d70fa9
commit 22ad48e9be
2 changed files with 5 additions and 6 deletions

View File

@ -104,8 +104,7 @@ const isWeekend = async () => {
else{ else{
// obj.set = true; // obj.set = true;
// obj.msg = weekend.message; // obj.msg = weekend.message;
} }
return obj; return obj;
} }
}; };

View File

@ -632,7 +632,7 @@ const handleMessage = async (msg: any, wbot: any): Promise<void> => {
// MESSAGE TO HOLIDAY // MESSAGE TO HOLIDAY
const holiday: any = await isHoliday(); const holiday: any = await isHoliday();
if (holiday.set) { if (holiday && holiday.set) {
if (msg.fromMe && holiday.msg == msg.body) { if (msg.fromMe && holiday.msg == msg.body) {
console.log("HOLIDAY MESSAGE IGNORED"); console.log("HOLIDAY MESSAGE IGNORED");
return; return;
@ -643,9 +643,9 @@ const handleMessage = async (msg: any, wbot: any): Promise<void> => {
} }
// MESSAGES TO SATURDAY OR SUNDAY // 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) { if (msg.fromMe && weekend.msg == msg.body) {
console.log("WEEKEND MESSAGE IGNORED"); console.log("WEEKEND MESSAGE IGNORED");
return; return;
@ -658,7 +658,7 @@ const handleMessage = async (msg: any, wbot: any): Promise<void> => {
// MESSAGE TO BUSINESS TIME // MESSAGE TO BUSINESS TIME
const businessTime = await isOutBusinessTime(); const businessTime = await isOutBusinessTime();
if (businessTime.set) { if (businessTime && businessTime.set) {
if (msg.fromMe && businessTime.msg == msg.body) { if (msg.fromMe && businessTime.msg == msg.body) {
console.log("BUSINESS TIME MESSAGE IGNORED"); console.log("BUSINESS TIME MESSAGE IGNORED");
return; return;