@@ -381,7 +381,7 @@ export class BaileysStartupService extends ChannelStartupService {
381381 qrcodeTerminal . generate ( qr , { small : true } , ( qrcode ) =>
382382 this . logger . log (
383383 `\n{ instance: ${ this . instance . name } pairingCode: ${ this . instance . qrcode . pairingCode } , qrcodeCount: ${ this . instance . qrcode . count } }\n` +
384- qrcode ,
384+ qrcode ,
385385 ) ,
386386 ) ;
387387
@@ -978,16 +978,16 @@ export class BaileysStartupService extends ChannelStartupService {
978978
979979 const messagesRepository : Set < string > = new Set (
980980 chatwootImport . getRepositoryMessagesCache ( instance ) ??
981- (
982- await this . prismaRepository . message . findMany ( {
983- select : { key : true } ,
984- where : { instanceId : this . instanceId } ,
985- } )
986- ) . map ( ( message ) => {
987- const key = message . key as { id : string } ;
988-
989- return key . id ;
990- } ) ,
981+ (
982+ await this . prismaRepository . message . findMany ( {
983+ select : { key : true } ,
984+ where : { instanceId : this . instanceId } ,
985+ } )
986+ ) . map ( ( message ) => {
987+ const key = message . key as { id : string } ;
988+
989+ return key . id ;
990+ } ) ,
991991 ) ;
992992
993993 if ( chatwootImport . getRepositoryMessagesCache ( instance ) === null ) {
@@ -1205,6 +1205,8 @@ export class BaileysStartupService extends ChannelStartupService {
12051205 received ?. message ?. ptvMessage ||
12061206 received ?. message ?. audioMessage ;
12071207
1208+ const isVideo = received ?. message ?. videoMessage ;
1209+
12081210 if ( this . localSettings . readMessages && received . key . id !== 'status@broadcast' ) {
12091211 await this . client . readMessages ( [ received . key ] ) ;
12101212 }
@@ -1275,6 +1277,12 @@ export class BaileysStartupService extends ChannelStartupService {
12751277 if ( isMedia ) {
12761278 if ( this . configService . get < S3 > ( 'S3' ) . ENABLE ) {
12771279 try {
1280+ if ( isVideo && ! this . configService . get < S3 > ( 'S3' ) . SAVE_VIDEO ) {
1281+ this . logger . warn ( 'Video upload is disabled. Skipping video upload.' ) ;
1282+ // Skip video upload by returning early from this block
1283+ return ;
1284+ }
1285+
12781286 const message : any = received ;
12791287
12801288 // Verificação adicional para garantir que há conteúdo de mídia real
@@ -2168,6 +2176,8 @@ export class BaileysStartupService extends ChannelStartupService {
21682176 messageSent ?. message ?. ptvMessage ||
21692177 messageSent ?. message ?. audioMessage ;
21702178
2179+ const isVideo = messageSent ?. message ?. videoMessage ;
2180+
21712181 if ( this . configService . get < Chatwoot > ( 'CHATWOOT' ) . ENABLED && this . localChatwoot ?. enabled && ! isIntegration ) {
21722182 this . chatwootService . eventWhatsapp (
21732183 Events . SEND_MESSAGE ,
@@ -2192,6 +2202,10 @@ export class BaileysStartupService extends ChannelStartupService {
21922202
21932203 if ( isMedia && this . configService . get < S3 > ( 'S3' ) . ENABLE ) {
21942204 try {
2205+ if ( isVideo && ! this . configService . get < S3 > ( 'S3' ) . SAVE_VIDEO ) {
2206+ throw new Error ( 'Video upload is disabled.' ) ;
2207+ }
2208+
21952209 const message : any = messageRaw ;
21962210
21972211 // Verificação adicional para garantir que há conteúdo de mídia real
0 commit comments