Skip to content

Commit 1f817df

Browse files
committed
fix: Correction of variables breaking lines in typebot
1 parent 8eced6c commit 1f817df

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### Feature
44
* New method of saving sessions to a file using worker, made in partnership with [codechat](https://github.com/code-chat-br/whatsapp-api)
5+
* Correction of variables breaking lines in typebot
56

67
# 1.8.0 (2024-05-27 16:10)
78

src/api/integrations/typebot/services/typebot.service.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,10 +525,14 @@ export class TypebotService {
525525
}
526526
}
527527

528-
if (element.type === 'p') {
528+
if (element.type === 'p' && element.type !== 'inline-variable') {
529529
text = text.trim() + '\n';
530530
}
531531

532+
if (element.type === 'inline-variable') {
533+
text = text.trim();
534+
}
535+
532536
if (element.type === 'ol') {
533537
text =
534538
'\n' +
@@ -582,6 +586,8 @@ export class TypebotService {
582586

583587
formattedText = formattedText.replace(/\*\*/g, '').replace(/__/, '').replace(/~~/, '').replace(/\n$/, '');
584588

589+
formattedText = formattedText.replace(/\n$/, '');
590+
585591
await instance.textMessage({
586592
number: remoteJid.split('@')[0],
587593
options: {

0 commit comments

Comments
 (0)