mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-24 17:38:40 -06:00
Merge branch 'develop' of github.com:EvolutionAPI/evolution-api into develop
This commit is contained in:
commit
a869d38499
@ -1021,10 +1021,12 @@ export class ChatwootService {
|
|||||||
body.conversation.meta.sender?.phone_number?.replace('+', '') || body.conversation.meta.sender?.identifier;
|
body.conversation.meta.sender?.phone_number?.replace('+', '') || body.conversation.meta.sender?.identifier;
|
||||||
// Chatwoot to Whatsapp
|
// Chatwoot to Whatsapp
|
||||||
const messageReceived = body.content
|
const messageReceived = body.content
|
||||||
.replaceAll(/(?<!\*)\*((?!\s)([^\n*]+?)(?<!\s))\*(?!\*)/g, '_$1_') // Substitui * por _
|
? body.content
|
||||||
.replaceAll(/\*{2}((?!\s)([^\n*]+?)(?<!\s))\*{2}/g, '*$1*') // Substitui ** por *
|
.replaceAll(/(?<!\*)\*((?!\s)([^\n*]+?)(?<!\s))\*(?!\*)/g, '_$1_') // Substitui * por _
|
||||||
.replaceAll(/~{2}((?!\s)([^\n*]+?)(?<!\s))~{2}/g, '~$1~') // Substitui ~~ por ~
|
.replaceAll(/\*{2}((?!\s)([^\n*]+?)(?<!\s))\*{2}/g, '*$1*') // Substitui ** por *
|
||||||
.replaceAll(/(?<!`)`((?!\s)([^`*]+?)(?<!\s))`(?!`)/g, '```$1```'); // Substitui ` por ```
|
.replaceAll(/~{2}((?!\s)([^\n*]+?)(?<!\s))~{2}/g, '~$1~') // Substitui ~~ por ~
|
||||||
|
.replaceAll(/(?<!`)`((?!\s)([^`*]+?)(?<!\s))`(?!`)/g, '```$1```') // Substitui ` por ```
|
||||||
|
: body.content;
|
||||||
|
|
||||||
const senderName = body?.sender?.name;
|
const senderName = body?.sender?.name;
|
||||||
const waInstance = this.waMonitor.waInstances[instance.instanceName];
|
const waInstance = this.waMonitor.waInstances[instance.instanceName];
|
||||||
@ -1484,10 +1486,13 @@ export class ChatwootService {
|
|||||||
this.logger.verbose('get conversation message');
|
this.logger.verbose('get conversation message');
|
||||||
|
|
||||||
// Whatsapp to Chatwoot
|
// Whatsapp to Chatwoot
|
||||||
const bodyMessage = await this.getConversationMessage(body.message)
|
const originalMessage = await this.getConversationMessage(body.message);
|
||||||
.replaceAll(/\*((?!\s)([^\n*]+?)(?<!\s))\*/g, '**$1**')
|
const bodyMessage = originalMessage
|
||||||
.replaceAll(/_((?!\s)([^\n_]+?)(?<!\s))_/g, '*$1*')
|
? originalMessage
|
||||||
.replaceAll(/~((?!\s)([^\n~]+?)(?<!\s))~/g, '~~$1~~');
|
.replaceAll(/\*((?!\s)([^\n*]+?)(?<!\s))\*/g, '**$1**')
|
||||||
|
.replaceAll(/_((?!\s)([^\n_]+?)(?<!\s))_/g, '*$1*')
|
||||||
|
.replaceAll(/~((?!\s)([^\n~]+?)(?<!\s))~/g, '~~$1~~')
|
||||||
|
: originalMessage;
|
||||||
|
|
||||||
this.logger.verbose('body message: ' + bodyMessage);
|
this.logger.verbose('body message: ' + bodyMessage);
|
||||||
|
|
||||||
|
@ -1233,10 +1233,14 @@ export class WAStartupService {
|
|||||||
this.logger.verbose('Connection opened');
|
this.logger.verbose('Connection opened');
|
||||||
this.instance.wuid = this.client.user.id.replace(/:\d+/, '');
|
this.instance.wuid = this.client.user.id.replace(/:\d+/, '');
|
||||||
this.instance.profilePictureUrl = (await this.profilePicture(this.instance.wuid)).profilePictureUrl;
|
this.instance.profilePictureUrl = (await this.profilePicture(this.instance.wuid)).profilePictureUrl;
|
||||||
|
const formattedWuid = this.instance.wuid.split('@')[0].padEnd(30, ' ');
|
||||||
|
const formattedName = this.instance.name.split('@')[0].padEnd(30, ' ');
|
||||||
this.logger.info(
|
this.logger.info(
|
||||||
`
|
`
|
||||||
┌──────────────────────────────┐
|
┌──────────────────────────────┐
|
||||||
│ CONNECTED TO WHATSAPP │
|
│ CONNECTED TO WHATSAPP │
|
||||||
|
│${formattedWuid}│
|
||||||
|
│${formattedName}│
|
||||||
└──────────────────────────────┘`.replace(/^ +/gm, ' '),
|
└──────────────────────────────┘`.replace(/^ +/gm, ' '),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user