mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-16 04:02:54 -06:00
simple add keep open
This commit is contained in:
parent
f612a45550
commit
ff82987144
@ -107,6 +107,7 @@ QRCODE_COLOR=#198754
|
|||||||
|
|
||||||
# old | latest
|
# old | latest
|
||||||
TYPEBOT_API_VERSION=latest
|
TYPEBOT_API_VERSION=latest
|
||||||
|
TYPEBOT_KEEP_OPEN=false
|
||||||
|
|
||||||
# Defines an authentication type for the api
|
# Defines an authentication type for the api
|
||||||
# We recommend using the apikey because it will allow you to use a custom token,
|
# We recommend using the apikey because it will allow you to use a custom token,
|
||||||
|
@ -130,7 +130,7 @@ export type SslConf = { PRIVKEY: string; FULLCHAIN: string };
|
|||||||
export type Webhook = { GLOBAL?: GlobalWebhook; EVENTS: EventsWebhook };
|
export type Webhook = { GLOBAL?: GlobalWebhook; EVENTS: EventsWebhook };
|
||||||
export type ConfigSessionPhone = { CLIENT: string; NAME: string };
|
export type ConfigSessionPhone = { CLIENT: string; NAME: string };
|
||||||
export type QrCode = { LIMIT: number; COLOR: string };
|
export type QrCode = { LIMIT: number; COLOR: string };
|
||||||
export type Typebot = { API_VERSION: string };
|
export type Typebot = { API_VERSION: string; KEEP_OPEN: boolean };
|
||||||
export type Production = boolean;
|
export type Production = boolean;
|
||||||
|
|
||||||
export interface Env {
|
export interface Env {
|
||||||
@ -308,6 +308,7 @@ export class ConfigService {
|
|||||||
},
|
},
|
||||||
TYPEBOT: {
|
TYPEBOT: {
|
||||||
API_VERSION: process.env?.TYPEBOT_API_VERSION || 'old',
|
API_VERSION: process.env?.TYPEBOT_API_VERSION || 'old',
|
||||||
|
KEEP_OPEN: process.env.TYPEBOT_KEEP_OPEN === 'true',
|
||||||
},
|
},
|
||||||
AUTHENTICATION: {
|
AUTHENTICATION: {
|
||||||
TYPE: process.env.AUTHENTICATION_TYPE as 'apikey',
|
TYPE: process.env.AUTHENTICATION_TYPE as 'apikey',
|
||||||
|
@ -148,6 +148,7 @@ QRCODE:
|
|||||||
|
|
||||||
TYPEBOT:
|
TYPEBOT:
|
||||||
API_VERSION: 'old' # old | latest
|
API_VERSION: 'old' # old | latest
|
||||||
|
KEEP_OPEN: false
|
||||||
|
|
||||||
# Defines an authentication type for the api
|
# Defines an authentication type for the api
|
||||||
# We recommend using the apikey because it will allow you to use a custom token,
|
# We recommend using the apikey because it will allow you to use a custom token,
|
||||||
|
@ -16,6 +16,9 @@ export class TypebotService {
|
|||||||
private readonly eventEmitter: EventEmitter2,
|
private readonly eventEmitter: EventEmitter2,
|
||||||
) {
|
) {
|
||||||
this.eventEmitter.on('typebot:end', async (data) => {
|
this.eventEmitter.on('typebot:end', async (data) => {
|
||||||
|
const keep_open = this.configService.get<Typebot>('TYPEBOT').KEEP_OPEN;
|
||||||
|
if (keep_open) return;
|
||||||
|
|
||||||
await this.clearSessions(data.instance, data.remoteJid);
|
await this.clearSessions(data.instance, data.remoteJid);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user