File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,6 +107,7 @@ QRCODE_COLOR=#198754
107107
108108# old | latest
109109TYPEBOT_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,
Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ export type SslConf = { PRIVKEY: string; FULLCHAIN: string };
130130export type Webhook = { GLOBAL ?: GlobalWebhook ; EVENTS : EventsWebhook } ;
131131export type ConfigSessionPhone = { CLIENT : string ; NAME : string } ;
132132export type QrCode = { LIMIT : number ; COLOR : string } ;
133- export type Typebot = { API_VERSION : string } ;
133+ export type Typebot = { API_VERSION : string ; KEEP_OPEN : boolean } ;
134134export type Production = boolean ;
135135
136136export 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' ,
Original file line number Diff line number Diff line change @@ -148,6 +148,7 @@ QRCODE:
148148
149149TYPEBOT :
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,
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments