@@ -76,19 +76,20 @@ import {
7676 S3 ,
7777} from '@config/env.config' ;
7878import { BadRequestException , InternalServerErrorException , NotFoundException } from '@exceptions' ;
79- import { AuthStateProvider } from '@utils/use-multi-file-auth-state-provider-files' ;
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' ;
8083import { createJid } from '@utils/createJid' ;
8184import { fetchLatestWaWebVersion } from '@utils/fetchLatestWaWebVersion' ;
82- import { getOnWhatsappCache , saveOnWhatsappCache } from '@utils/onWhatsappCache' ;
8385import { makeProxyAgent , makeProxyAgentUndici } from '@utils/makeProxyAgent' ;
86+ import { getOnWhatsappCache , saveOnWhatsappCache } from '@utils/onWhatsappCache' ;
8487import { status } from '@utils/renderStatus' ;
8588import { sendTelemetry } from '@utils/sendTelemetry' ;
8689import useMultiFileAuthStatePrisma from '@utils/use-multi-file-auth-state-prisma' ;
90+ import { AuthStateProvider } from '@utils/use-multi-file-auth-state-provider-files' ;
8791import { useMultiFileAuthStateRedisDb } from '@utils/use-multi-file-auth-state-redis-db' ;
88-
89- import { BaileysMessageProcessor } from './baileysMessage.processor' ;
90- import { useVoiceCallsBaileys } from './voiceCalls/useVoiceCallsBaileys' ;
91-
92+ import axios from 'axios' ;
9293import makeWASocket , {
9394 AnyMessageContent ,
9495 BufferedEventData ,
@@ -98,8 +99,8 @@ import makeWASocket, {
9899 Chat ,
99100 ConnectionState ,
100101 Contact ,
101- delay ,
102102 decryptPollVote ,
103+ delay ,
103104 DisconnectReason ,
104105 downloadContentFromMessage ,
105106 downloadMediaMessage ,
@@ -132,30 +133,28 @@ import makeWASocket, {
132133} from 'baileys' ;
133134import { Label } from 'baileys/lib/Types/Label' ;
134135import { LabelAssociation } from 'baileys/lib/Types/LabelAssociation' ;
135- import { createId as cuid } from '@paralleldrive/cuid2' ;
136- import { Instance , Message } from '@prisma/client' ;
137- import axios from 'axios' ;
136+ import { spawn } from 'child_process' ;
138137import { isArray , isBase64 , isURL } from 'class-validator' ;
139138import { createHash } from 'crypto' ;
140139import EventEmitter2 from 'eventemitter2' ;
141140import ffmpeg from 'fluent-ffmpeg' ;
142- import ffmpegPath from '@ffmpeg-installer/ffmpeg' ;
143141import FormData from 'form-data' ;
144- import { Boom } from '@hapi/boom' ;
145142import Long from 'long' ;
146143import mimeTypes from 'mime-types' ;
147- import cron from 'node-cron' ;
148144import NodeCache from 'node-cache' ;
145+ import cron from 'node-cron' ;
149146import { release } from 'os' ;
150147import { join } from 'path' ;
151148import P from 'pino' ;
152149import qrcode , { QRCodeToDataURLOptions } from 'qrcode' ;
153150import qrcodeTerminal from 'qrcode-terminal' ;
154151import sharp from 'sharp' ;
155152import { PassThrough , Readable } from 'stream' ;
156- import { spawn } from 'child_process' ;
157153import { v4 } from 'uuid' ;
158154
155+ import { BaileysMessageProcessor } from './baileysMessage.processor' ;
156+ import { useVoiceCallsBaileys } from './voiceCalls/useVoiceCallsBaileys' ;
157+
159158export interface ExtendedIMessageKey extends proto . IMessageKey {
160159 remoteJidAlt ?: string ;
161160 participantAlt ?: string ;
@@ -1250,9 +1249,7 @@ export class BaileysStartupService extends ChannelStartupService {
12501249 const uniqueCreators = [
12511250 ...new Set ( creatorCandidates . filter ( Boolean ) . map ( ( id ) => jidNormalizedUser ( id ) ) ) ,
12521251 ] ;
1253- const uniqueVoters = [
1254- ...new Set ( voterCandidates . filter ( Boolean ) . map ( ( id ) => jidNormalizedUser ( id ) ) )
1255- ] ;
1252+ const uniqueVoters = [ ...new Set ( voterCandidates . filter ( Boolean ) . map ( ( id ) => jidNormalizedUser ( id ) ) ) ] ;
12561253
12571254 let decryptedVote ;
12581255
@@ -1269,7 +1266,7 @@ export class BaileysStartupService extends ChannelStartupService {
12691266 successfulVoterJid = voter ;
12701267 break ;
12711268 }
1272- } catch ( _err ) {
1269+ } catch {
12731270 // Continue trying
12741271 }
12751272 }
@@ -1350,7 +1347,8 @@ export class BaileysStartupService extends ChannelStartupService {
13501347 }
13511348
13521349 if ( this . configService . get < Database > ( 'DATABASE' ) . SAVE_DATA . NEW_MESSAGE ) {
1353- const { _pollUpdates, ...messageData } = messageRaw ;
1350+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1351+ const { pollUpdates, ...messageData } = messageRaw ;
13541352 const msg = await this . prismaRepository . message . create ( { data : messageData } ) ;
13551353
13561354 const { remoteJid } = received . key ;
@@ -1561,6 +1559,7 @@ export class BaileysStartupService extends ChannelStartupService {
15611559 const cached = await this . baileysCache . get ( updateKey ) ;
15621560
15631561 const secondsSinceEpoch = Math . floor ( Date . now ( ) / 1000 ) ;
1562+ console . log ( 'CACHE:' , { cached, updateKey, messageTimestamp : update . messageTimestamp , secondsSinceEpoch } ) ;
15641563
15651564 if (
15661565 ( update . messageTimestamp && update . messageTimestamp === cached ) ||
@@ -1692,7 +1691,8 @@ export class BaileysStartupService extends ChannelStartupService {
16921691 this . sendDataWebhook ( Events . MESSAGES_UPDATE , message ) ;
16931692
16941693 if ( this . configService . get < Database > ( 'DATABASE' ) . SAVE_DATA . MESSAGE_UPDATE ) {
1695- const { message : __msg , ...messageData } = message ;
1694+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1695+ const { message : _msg , ...messageData } = message ;
16961696 await this . prismaRepository . messageUpdate . create ( { data : messageData } ) ;
16971697 }
16981698
0 commit comments