Skip to content

Commit e48cea1

Browse files
Merge pull request #283 from gabrielpastori1/typeboot-keep-open
simple add keep open
2 parents f612a45 + ff82987 commit e48cea1

4 files changed

Lines changed: 7 additions & 1 deletion

File tree

Docker/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ QRCODE_COLOR=#198754
107107

108108
# old | latest
109109
TYPEBOT_API_VERSION=latest
110+
TYPEBOT_KEEP_OPEN=false
110111

111112
# Defines an authentication type for the api
112113
# We recommend using the apikey because it will allow you to use a custom token,

src/config/env.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export type SslConf = { PRIVKEY: string; FULLCHAIN: string };
130130
export type Webhook = { GLOBAL?: GlobalWebhook; EVENTS: EventsWebhook };
131131
export type ConfigSessionPhone = { CLIENT: string; NAME: string };
132132
export type QrCode = { LIMIT: number; COLOR: string };
133-
export type Typebot = { API_VERSION: string };
133+
export type Typebot = { API_VERSION: string; KEEP_OPEN: boolean };
134134
export type Production = boolean;
135135

136136
export interface Env {
@@ -308,6 +308,7 @@ export class ConfigService {
308308
},
309309
TYPEBOT: {
310310
API_VERSION: process.env?.TYPEBOT_API_VERSION || 'old',
311+
KEEP_OPEN: process.env.TYPEBOT_KEEP_OPEN === 'true',
311312
},
312313
AUTHENTICATION: {
313314
TYPE: process.env.AUTHENTICATION_TYPE as 'apikey',

src/dev-env.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ QRCODE:
148148

149149
TYPEBOT:
150150
API_VERSION: 'old' # old | latest
151+
KEEP_OPEN: false
151152

152153
# Defines an authentication type for the api
153154
# We recommend using the apikey because it will allow you to use a custom token,

src/whatsapp/services/typebot.service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ export class TypebotService {
1616
private readonly eventEmitter: EventEmitter2,
1717
) {
1818
this.eventEmitter.on('typebot:end', async (data) => {
19+
const keep_open = this.configService.get<Typebot>('TYPEBOT').KEEP_OPEN;
20+
if (keep_open) return;
21+
1922
await this.clearSessions(data.instance, data.remoteJid);
2023
});
2124
}

0 commit comments

Comments
 (0)