@@ -368,7 +368,7 @@ export class BaileysStartupService extends ChannelStartupService {
368368 qrcodeTerminal . generate ( qr , { small : true } , ( qrcode ) =>
369369 this . logger . log (
370370 `\n{ instance: ${ this . instance . name } pairingCode: ${ this . instance . qrcode . pairingCode } , qrcodeCount: ${ this . instance . qrcode . count } }\n` +
371- qrcode ,
371+ qrcode ,
372372 ) ,
373373 ) ;
374374
@@ -961,16 +961,16 @@ export class BaileysStartupService extends ChannelStartupService {
961961
962962 const messagesRepository : Set < string > = new Set (
963963 chatwootImport . getRepositoryMessagesCache ( instance ) ??
964- (
965- await this . prismaRepository . message . findMany ( {
966- select : { key : true } ,
967- where : { instanceId : this . instanceId } ,
968- } )
969- ) . map ( ( message ) => {
970- const key = message . key as { id : string } ;
971-
972- return key . id ;
973- } ) ,
964+ (
965+ await this . prismaRepository . message . findMany ( {
966+ select : { key : true } ,
967+ where : { instanceId : this . instanceId } ,
968+ } )
969+ ) . map ( ( message ) => {
970+ const key = message . key as { id : string } ;
971+
972+ return key . id ;
973+ } ) ,
974974 ) ;
975975
976976 if ( chatwootImport . getRepositoryMessagesCache ( instance ) === null ) {
@@ -1188,6 +1188,8 @@ export class BaileysStartupService extends ChannelStartupService {
11881188 received ?. message ?. ptvMessage ||
11891189 received ?. message ?. audioMessage ;
11901190
1191+ const isVideo = received ?. message ?. videoMessage ;
1192+
11911193 if ( this . localSettings . readMessages && received . key . id !== 'status@broadcast' ) {
11921194 await this . client . readMessages ( [ received . key ] ) ;
11931195 }
@@ -1258,6 +1260,10 @@ export class BaileysStartupService extends ChannelStartupService {
12581260 if ( isMedia ) {
12591261 if ( this . configService . get < S3 > ( 'S3' ) . ENABLE ) {
12601262 try {
1263+ if ( isVideo && ! this . configService . get < S3 > ( 'S3' ) . SAVE_VIDEO ) {
1264+ throw new Error ( 'Video upload is disabled.' ) ;
1265+ }
1266+
12611267 const message : any = received ;
12621268
12631269 // Verificação adicional para garantir que há conteúdo de mídia real
@@ -2143,6 +2149,8 @@ export class BaileysStartupService extends ChannelStartupService {
21432149 messageSent ?. message ?. ptvMessage ||
21442150 messageSent ?. message ?. audioMessage ;
21452151
2152+ const isVideo = messageSent ?. message ?. videoMessage ;
2153+
21462154 if ( this . configService . get < Chatwoot > ( 'CHATWOOT' ) . ENABLED && this . localChatwoot ?. enabled && ! isIntegration ) {
21472155 this . chatwootService . eventWhatsapp (
21482156 Events . SEND_MESSAGE ,
@@ -2167,6 +2175,10 @@ export class BaileysStartupService extends ChannelStartupService {
21672175
21682176 if ( isMedia && this . configService . get < S3 > ( 'S3' ) . ENABLE ) {
21692177 try {
2178+ if ( isVideo && ! this . configService . get < S3 > ( 'S3' ) . SAVE_VIDEO ) {
2179+ throw new Error ( 'Video upload is disabled.' ) ;
2180+ }
2181+
21702182 const message : any = messageRaw ;
21712183
21722184 // Verificação adicional para garantir que há conteúdo de mídia real
0 commit comments