fix: adjusts in connection

This commit is contained in:
Davidson Gomes 2023-12-08 18:44:52 -03:00
parent 41b2946cdc
commit 9a5dbe055e
3 changed files with 13 additions and 12 deletions

View File

@ -78,10 +78,6 @@ export type Websocket = {
ENABLED: boolean; ENABLED: boolean;
}; };
export type Chatwoot = {
USE_REPLY_ID: boolean;
};
export type EventsWebhook = { export type EventsWebhook = {
APPLICATION_STARTUP: boolean; APPLICATION_STARTUP: boolean;
QRCODE_UPDATED: boolean; QRCODE_UPDATED: boolean;
@ -154,7 +150,6 @@ export interface Env {
TYPEBOT: Typebot; TYPEBOT: Typebot;
AUTHENTICATION: Auth; AUTHENTICATION: Auth;
PRODUCTION?: Production; PRODUCTION?: Production;
CHATWOOT?: Chatwoot;
} }
export type Key = keyof Env; export type Key = keyof Env;
@ -323,9 +318,6 @@ export class ConfigService {
SECRET: process.env.AUTHENTICATION_JWT_SECRET || 'L=0YWt]b2w[WF>#>:&E`', SECRET: process.env.AUTHENTICATION_JWT_SECRET || 'L=0YWt]b2w[WF>#>:&E`',
}, },
}, },
CHATWOOT: {
USE_REPLY_ID: process.env?.USE_REPLY_ID === 'true',
},
}; };
} }
} }

View File

@ -164,7 +164,3 @@ AUTHENTICATION:
JWT: JWT:
EXPIRIN_IN: 0 # seconds - 3600s === 1h | zero (0) - never expires EXPIRIN_IN: 0 # seconds - 3600s === 1h | zero (0) - never expires
SECRET: L=0YWt]b2w[WF>#>:&E` SECRET: L=0YWt]b2w[WF>#>:&E`
# Configure to chatwoot
CHATWOOT:
USE_REPLY_ID: false

View File

@ -17,6 +17,7 @@ import makeWASocket, {
getContentType, getContentType,
getDevice, getDevice,
GroupMetadata, GroupMetadata,
isJidBroadcast,
isJidGroup, isJidGroup,
isJidUser, isJidUser,
makeCacheableSignalKeyStore, makeCacheableSignalKeyStore,
@ -1333,6 +1334,12 @@ export class WAStartupService {
qrTimeout: 40_000, qrTimeout: 40_000,
defaultQueryTimeoutMs: undefined, defaultQueryTimeoutMs: undefined,
emitOwnEvents: false, emitOwnEvents: false,
shouldIgnoreJid: (jid) => {
const isGroupJid = this.localSettings.groups_ignore && isJidGroup(jid);
const isBroadcast = !this.localSettings.read_status && isJidBroadcast(jid);
return isGroupJid || isBroadcast;
},
msgRetryCounterCache: this.msgRetryCounterCache, msgRetryCounterCache: this.msgRetryCounterCache,
getMessage: async (key) => (await this.getMessage(key)) as Promise<proto.IMessage>, getMessage: async (key) => (await this.getMessage(key)) as Promise<proto.IMessage>,
generateHighQualityLinkPreview: true, generateHighQualityLinkPreview: true,
@ -1414,6 +1421,12 @@ export class WAStartupService {
qrTimeout: 40_000, qrTimeout: 40_000,
defaultQueryTimeoutMs: undefined, defaultQueryTimeoutMs: undefined,
emitOwnEvents: false, emitOwnEvents: false,
shouldIgnoreJid: (jid) => {
const isGroupJid = this.localSettings.groups_ignore && isJidGroup(jid);
const isBroadcast = !this.localSettings.read_status && isJidBroadcast(jid);
return isGroupJid || isBroadcast;
},
msgRetryCounterCache: this.msgRetryCounterCache, msgRetryCounterCache: this.msgRetryCounterCache,
getMessage: async (key) => (await this.getMessage(key)) as Promise<proto.IMessage>, getMessage: async (key) => (await this.getMessage(key)) as Promise<proto.IMessage>,
generateHighQualityLinkPreview: true, generateHighQualityLinkPreview: true,