File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed
Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,10 @@ export class ChatwootService {
4646 instance . instanceName
4747 ] . findChatwoot ( ) ;
4848
49+ if ( ! provider ) {
50+ return null ;
51+ }
52+
4953 return provider ;
5054 }
5155
@@ -102,6 +106,10 @@ export class ChatwootService {
102106 id,
103107 } ) ;
104108
109+ if ( ! contact ) {
110+ return null ;
111+ }
112+
105113 return contact ;
106114 }
107115
@@ -126,6 +134,10 @@ export class ChatwootService {
126134 } ,
127135 } ) ;
128136
137+ if ( ! contact ) {
138+ return null ;
139+ }
140+
129141 return contact ;
130142 }
131143
@@ -536,7 +548,7 @@ export class ChatwootService {
536548 formatText = messageReceived ;
537549 } else {
538550 formatText = this . provider . sign_msg
539- ? `*${ senderName } *: ${ messageReceived } `
551+ ? `*${ senderName } :*\n\n ${ messageReceived } `
540552 : messageReceived ;
541553 }
542554
@@ -631,10 +643,6 @@ export class ChatwootService {
631643 const waInstance = this . waMonitor . waInstances [ instance . instanceName ] ;
632644
633645 if ( event === 'messages.upsert' ) {
634- // if (body.key.fromMe && !IMPORT_MESSAGES_SENT) {
635- // return;
636- // }
637-
638646 if ( body . key . remoteJid === 'status@broadcast' ) {
639647 return ;
640648 }
@@ -699,6 +707,11 @@ export class ChatwootService {
699707 if ( event === 'status.instance' ) {
700708 const data = body ;
701709 const inbox = await this . getInbox ( instance ) ;
710+
711+ if ( ! inbox ) {
712+ return ;
713+ }
714+
702715 const msgStatus = `⚡️ Status da instância ${ inbox . name } : ${ data . status } ` ;
703716 await this . createBotMessage ( instance , msgStatus , 'incoming' ) ;
704717 }
You can’t perform that action at this time.
0 commit comments