Skip to content

Commit

Permalink
fix: Correction of variables breaking lines in typebot
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidsonGomes committed Jun 9, 2024
1 parent 8eced6c commit 1f817df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

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

Expand Down
8 changes: 7 additions & 1 deletion src/api/integrations/typebot/services/typebot.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,10 +525,14 @@ export class TypebotService {
}
}

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

if (element.type === 'inline-variable') {
text = text.trim();
}

if (element.type === 'ol') {
text =
'\n' +
Expand Down Expand Up @@ -582,6 +586,8 @@ export class TypebotService {

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

formattedText = formattedText.replace(/\n$/, '');

await instance.textMessage({
number: remoteJid.split('@')[0],
options: {
Expand Down

0 comments on commit 1f817df

Please sign in to comment.