Skip to content

Commit 9a5dbe0

Browse files
committed
fix: adjusts in connection
1 parent 41b2946 commit 9a5dbe0

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

src/config/env.config.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ export type Websocket = {
7878
ENABLED: boolean;
7979
};
8080

81-
export type Chatwoot = {
82-
USE_REPLY_ID: boolean;
83-
};
84-
8581
export type EventsWebhook = {
8682
APPLICATION_STARTUP: boolean;
8783
QRCODE_UPDATED: boolean;
@@ -154,7 +150,6 @@ export interface Env {
154150
TYPEBOT: Typebot;
155151
AUTHENTICATION: Auth;
156152
PRODUCTION?: Production;
157-
CHATWOOT?: Chatwoot;
158153
}
159154

160155
export type Key = keyof Env;
@@ -323,9 +318,6 @@ export class ConfigService {
323318
SECRET: process.env.AUTHENTICATION_JWT_SECRET || 'L=0YWt]b2w[WF>#>:&E`',
324319
},
325320
},
326-
CHATWOOT: {
327-
USE_REPLY_ID: process.env?.USE_REPLY_ID === 'true',
328-
},
329321
};
330322
}
331323
}

src/dev-env.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,3 @@ AUTHENTICATION:
164164
JWT:
165165
EXPIRIN_IN: 0 # seconds - 3600s === 1h | zero (0) - never expires
166166
SECRET: L=0YWt]b2w[WF>#>:&E`
167-
168-
# Configure to chatwoot
169-
CHATWOOT:
170-
USE_REPLY_ID: false

src/whatsapp/services/whatsapp.service.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import makeWASocket, {
1717
getContentType,
1818
getDevice,
1919
GroupMetadata,
20+
isJidBroadcast,
2021
isJidGroup,
2122
isJidUser,
2223
makeCacheableSignalKeyStore,
@@ -1333,6 +1334,12 @@ export class WAStartupService {
13331334
qrTimeout: 40_000,
13341335
defaultQueryTimeoutMs: undefined,
13351336
emitOwnEvents: false,
1337+
shouldIgnoreJid: (jid) => {
1338+
const isGroupJid = this.localSettings.groups_ignore && isJidGroup(jid);
1339+
const isBroadcast = !this.localSettings.read_status && isJidBroadcast(jid);
1340+
1341+
return isGroupJid || isBroadcast;
1342+
},
13361343
msgRetryCounterCache: this.msgRetryCounterCache,
13371344
getMessage: async (key) => (await this.getMessage(key)) as Promise<proto.IMessage>,
13381345
generateHighQualityLinkPreview: true,
@@ -1414,6 +1421,12 @@ export class WAStartupService {
14141421
qrTimeout: 40_000,
14151422
defaultQueryTimeoutMs: undefined,
14161423
emitOwnEvents: false,
1424+
shouldIgnoreJid: (jid) => {
1425+
const isGroupJid = this.localSettings.groups_ignore && isJidGroup(jid);
1426+
const isBroadcast = !this.localSettings.read_status && isJidBroadcast(jid);
1427+
1428+
return isGroupJid || isBroadcast;
1429+
},
14171430
msgRetryCounterCache: this.msgRetryCounterCache,
14181431
getMessage: async (key) => (await this.getMessage(key)) as Promise<proto.IMessage>,
14191432
generateHighQualityLinkPreview: true,

0 commit comments

Comments
 (0)