@@ -76,21 +76,19 @@ import {
7676 S3 ,
7777} from '@config/env.config' ;
7878import { BadRequestException , InternalServerErrorException , NotFoundException } from '@exceptions' ;
79- import ffmpegPath from '@ffmpeg-installer/ffmpeg' ;
80- import { Boom } from '@hapi/boom' ;
81- import { createId as cuid } from '@paralleldrive/cuid2' ;
82- import { Instance , Message } from '@prisma/client' ;
79+ import { AuthStateProvider } from '@utils/use-multi-file-auth-state-provider-files' ;
8380import { createJid } from '@utils/createJid' ;
8481import { fetchLatestWaWebVersion } from '@utils/fetchLatestWaWebVersion' ;
85- import { makeProxyAgent , makeProxyAgentUndici } from '@utils/makeProxyAgent' ;
8682import { getOnWhatsappCache , saveOnWhatsappCache } from '@utils/onWhatsappCache' ;
83+ import { makeProxyAgent , makeProxyAgentUndici } from '@utils/makeProxyAgent' ;
8784import { status } from '@utils/renderStatus' ;
8885import { sendTelemetry } from '@utils/sendTelemetry' ;
8986import useMultiFileAuthStatePrisma from '@utils/use-multi-file-auth-state-prisma' ;
90- import { AuthStateProvider } from '@utils/use-multi-file-auth-state-provider-files' ;
9187import { useMultiFileAuthStateRedisDb } from '@utils/use-multi-file-auth-state-redis-db' ;
92- import axios from 'axios' ;
93- import { createHash } from 'crypto' ;
88+
89+ import { BaileysMessageProcessor } from './baileysMessage.processor' ;
90+ import { useVoiceCallsBaileys } from './voiceCalls/useVoiceCallsBaileys' ;
91+
9492import makeWASocket , {
9593 AnyMessageContent ,
9694 BufferedEventData ,
@@ -105,7 +103,6 @@ import makeWASocket, {
105103 DisconnectReason ,
106104 downloadContentFromMessage ,
107105 downloadMediaMessage ,
108- jidNormalizedUser ,
109106 generateWAMessageFromContent ,
110107 getAggregateVotesInPollMessage ,
111108 GetCatalogOptions ,
@@ -116,6 +113,7 @@ import makeWASocket, {
116113 isJidGroup ,
117114 isJidNewsletter ,
118115 isPnUser ,
116+ jidNormalizedUser ,
119117 makeCacheableSignalKeyStore ,
120118 MessageUpsertType ,
121119 MessageUserReceiptUpdate ,
@@ -134,27 +132,30 @@ import makeWASocket, {
134132} from 'baileys' ;
135133import { Label } from 'baileys/lib/Types/Label' ;
136134import { LabelAssociation } from 'baileys/lib/Types/LabelAssociation' ;
137- import { spawn } from 'child_process' ;
135+ import { createId as cuid } from '@paralleldrive/cuid2' ;
136+ import { Instance , Message } from '@prisma/client' ;
137+ import axios from 'axios' ;
138138import { isArray , isBase64 , isURL } from 'class-validator' ;
139+ import { createHash } from 'crypto' ;
139140import EventEmitter2 from 'eventemitter2' ;
140141import ffmpeg from 'fluent-ffmpeg' ;
142+ import ffmpegPath from '@ffmpeg-installer/ffmpeg' ;
141143import FormData from 'form-data' ;
144+ import { Boom } from '@hapi/boom' ;
142145import Long from 'long' ;
143146import mimeTypes from 'mime-types' ;
144- import NodeCache from 'node-cache' ;
145147import cron from 'node-cron' ;
148+ import NodeCache from 'node-cache' ;
146149import { release } from 'os' ;
147150import { join } from 'path' ;
148151import P from 'pino' ;
149152import qrcode , { QRCodeToDataURLOptions } from 'qrcode' ;
150153import qrcodeTerminal from 'qrcode-terminal' ;
151154import sharp from 'sharp' ;
152155import { PassThrough , Readable } from 'stream' ;
156+ import { spawn } from 'child_process' ;
153157import { v4 } from 'uuid' ;
154158
155- import { BaileysMessageProcessor } from './baileysMessage.processor' ;
156- import { useVoiceCallsBaileys } from './voiceCalls/useVoiceCallsBaileys' ;
157-
158159export interface ExtendedIMessageKey extends proto . IMessageKey {
159160 remoteJidAlt ?: string ;
160161 participantAlt ?: string ;
@@ -1250,7 +1251,7 @@ export class BaileysStartupService extends ChannelStartupService {
12501251 ...new Set ( creatorCandidates . filter ( Boolean ) . map ( ( id ) => jidNormalizedUser ( id ) ) ) ,
12511252 ] ;
12521253 const uniqueVoters = [
1253- ...new Set ( voterCandidates . filter ( Boolean ) . map ( ( id ) => jidNormalizedUser ( id ) ) ) ,
1254+ ...new Set ( voterCandidates . filter ( Boolean ) . map ( ( id ) => jidNormalizedUser ( id ) ) )
12541255 ] ;
12551256
12561257 let decryptedVote ;
@@ -1268,7 +1269,7 @@ export class BaileysStartupService extends ChannelStartupService {
12681269 successfulVoterJid = voter ;
12691270 break ;
12701271 }
1271- } catch ( err ) {
1272+ } catch ( _err ) {
12721273 // Continue trying
12731274 }
12741275 }
@@ -1349,7 +1350,7 @@ export class BaileysStartupService extends ChannelStartupService {
13491350 }
13501351
13511352 if ( this . configService . get < Database > ( 'DATABASE' ) . SAVE_DATA . NEW_MESSAGE ) {
1352- const { pollUpdates , ...messageData } = messageRaw ;
1353+ const { _pollUpdates , ...messageData } = messageRaw ;
13531354 const msg = await this . prismaRepository . message . create ( { data : messageData } ) ;
13541355
13551356 const { remoteJid } = received . key ;
@@ -1559,10 +1560,12 @@ export class BaileysStartupService extends ChannelStartupService {
15591560
15601561 const cached = await this . baileysCache . get ( updateKey ) ;
15611562
1562- const secondsSinceEpoch = Math . floor ( Date . now ( ) / 1000 )
1563- console . log ( 'CACHE:' , { cached, updateKey, messageTimestamp : update . messageTimestamp , secondsSinceEpoch} ) ;
1563+ const secondsSinceEpoch = Math . floor ( Date . now ( ) / 1000 ) ;
15641564
1565- if ( ( update . messageTimestamp && update . messageTimestamp === cached ) || ( ! update . messageTimestamp && secondsSinceEpoch === cached ) ) {
1565+ if (
1566+ ( update . messageTimestamp && update . messageTimestamp === cached ) ||
1567+ ( ! update . messageTimestamp && secondsSinceEpoch === cached )
1568+ ) {
15661569 this . logger . info ( `Update Message duplicated ignored [avoid deadlock]: ${ updateKey } ` ) ;
15671570 continue ;
15681571 }
@@ -1689,7 +1692,7 @@ export class BaileysStartupService extends ChannelStartupService {
16891692 this . sendDataWebhook ( Events . MESSAGES_UPDATE , message ) ;
16901693
16911694 if ( this . configService . get < Database > ( 'DATABASE' ) . SAVE_DATA . MESSAGE_UPDATE ) {
1692- const { message : _msg , ...messageData } = message ;
1695+ const { message : __msg , ...messageData } = message ;
16931696 await this . prismaRepository . messageUpdate . create ( { data : messageData } ) ;
16941697 }
16951698
0 commit comments