@@ -553,6 +553,10 @@ export class BaileysStartupService extends ChannelStartupService {
553553 }
554554 }
555555
556+ private getUpsertEmittedCacheKey ( messageId : string ) {
557+ return `upsert_emitted_${ this . instanceId } _${ messageId } ` ;
558+ }
559+
556560 private async defineAuthState ( ) {
557561 const db = this . configService . get < Database > ( 'DATABASE' ) ;
558562 const cache = this . configService . get < CacheConf > ( 'CACHE' ) ;
@@ -1477,12 +1481,10 @@ export class BaileysStartupService extends ChannelStartupService {
14771481 if ( messageRaw . key . remoteJid ?. includes ( '@lid' ) && messageRaw . key . remoteJidAlt ) {
14781482 messageRaw . key . remoteJid = messageRaw . key . remoteJidAlt ;
14791483 }
1480- console . log ( messageRaw ) ;
1481-
14821484 await this . sendDataWebhook ( Events . MESSAGES_UPSERT , messageRaw ) ;
14831485
14841486 if ( messageRaw . messageType === 'audioMessage' && ! messageRaw . key . fromMe && messageRaw . key . id ) {
1485- await this . baileysCache . set ( `upsert_emitted_ ${ this . instanceId } _ ${ messageRaw . key . id } ` , true , 60 * 10 ) ;
1487+ await this . baileysCache . set ( this . getUpsertEmittedCacheKey ( messageRaw . key . id ) , true , 60 * 10 ) ;
14861488 }
14871489
14881490 await chatbotController . emit ( {
@@ -1654,7 +1656,7 @@ export class BaileysStartupService extends ChannelStartupService {
16541656 }
16551657
16561658 if ( ! key . fromMe && findMessage . messageType === 'audioMessage' && key . id ) {
1657- const upsertCacheKey = `upsert_emitted_ ${ this . instanceId } _ ${ key . id } ` ;
1659+ const upsertCacheKey = this . getUpsertEmittedCacheKey ( key . id ) ;
16581660 const alreadyEmitted = await this . baileysCache . get ( upsertCacheKey ) ;
16591661
16601662 if ( ! alreadyEmitted ) {
0 commit comments