@@ -1019,7 +1019,13 @@ export class ChatwootService {
10191019 this . logger . verbose ( 'check if is group' ) ;
10201020 const chatId =
10211021 body . conversation . meta . sender ?. phone_number ?. replace ( '+' , '' ) || body . conversation . meta . sender ?. identifier ;
1022- const messageReceived = body . content ;
1022+ // Alterado por Edison Martins em 16/12/2023
1023+ // const messageReceived = body.content;
1024+ const messageReceived = body . content
1025+ . replaceAll ( / \* ( (? ! \s ) ( [ ^ \n * ] + ?) (?< ! \s ) ) \* / g, '_$1_' ) // Substitui * por _
1026+ . replaceAll ( / \* { 2 } ( (? ! \s ) ( [ ^ \n * ] + ?) (?< ! \s ) ) \* { 2 } / g, '*$1*' ) // Substitui ** por *
1027+ . replace ( / ~ { 2 } ( (? ! \s ) ( [ ^ \n * ] + ?) (?< ! \s ) ) ~ { 2 } / g, '~$1~' ) ; // Substitui ~~ por ~
1028+
10231029 const senderName = body ?. sender ?. name ;
10241030 const waInstance = this . waMonitor . waInstances [ instance . instanceName ] ;
10251031
@@ -1470,7 +1476,15 @@ export class ChatwootService {
14701476 }
14711477
14721478 this . logger . verbose ( 'get conversation message' ) ;
1473- const bodyMessage = await this . getConversationMessage ( body . message ) ;
1479+
1480+ // Alterado por Edison Martins em 15/12/2023
1481+ // const bodyMessage = await this.getConversationMessage(body.message);
1482+ const bodyMessage = await this . getConversationMessage ( body . message )
1483+ . replaceAll ( / \* ( (? ! \s ) ( [ ^ \n * ] + ?) (?< ! \s ) ) \* / g, '**$1**' )
1484+ . replaceAll ( / _ ( (? ! \s ) ( [ ^ \n _ ] + ?) (?< ! \s ) ) _ / g, '*$1*' )
1485+ . replaceAll ( / ~ ( (? ! \s ) ( [ ^ \n ~ ] + ?) (?< ! \s ) ) ~ / g, '~~$1~~' ) ;
1486+
1487+ this . logger . verbose ( 'body message: ' + bodyMessage ) ;
14741488
14751489 if ( bodyMessage && bodyMessage . includes ( 'Por favor, classifique esta conversa, http' ) ) {
14761490 this . logger . verbose ( 'conversation is closed' ) ;
0 commit comments