@@ -439,7 +439,6 @@ export class BaileysStartupService extends ChannelStartupService {
439439
440440 return webMessageInfo [ 0 ] . message ;
441441 } catch ( error ) {
442- this . logger . error ( 'line 508' ) ;
443442 return { conversation : '' } ;
444443 }
445444 }
@@ -594,7 +593,6 @@ export class BaileysStartupService extends ChannelStartupService {
594593
595594 return await this . createClient ( number ) ;
596595 } catch ( error ) {
597- this . logger . error ( 'line 667' ) ;
598596 this . logger . error ( error ) ;
599597 throw new InternalServerErrorException ( error ?. toString ( ) ) ;
600598 }
@@ -604,7 +602,6 @@ export class BaileysStartupService extends ChannelStartupService {
604602 try {
605603 return await this . createClient ( this . phoneNumber ) ;
606604 } catch ( error ) {
607- this . logger . error ( 'line 677' ) ;
608605 this . logger . error ( error ) ;
609606 throw new InternalServerErrorException ( error ?. toString ( ) ) ;
610607 }
@@ -763,7 +760,6 @@ export class BaileysStartupService extends ChannelStartupService {
763760 }
764761 } catch ( error ) {
765762 console . error ( error ) ;
766- this . logger . error ( 'line 817' ) ;
767763 this . logger . error ( `Error: ${ error . message } ` ) ;
768764 }
769765 } ,
@@ -953,7 +949,6 @@ export class BaileysStartupService extends ChannelStartupService {
953949 messages = undefined ;
954950 chats = undefined ;
955951 } catch ( error ) {
956- this . logger . error ( 'line 1011' ) ;
957952 this . logger . error ( error ) ;
958953 }
959954 } ,
@@ -1141,7 +1136,6 @@ export class BaileysStartupService extends ChannelStartupService {
11411136 data : messageRaw ,
11421137 } ) ;
11431138 } catch ( error ) {
1144- this . logger . error ( 'line 1181' ) ;
11451139 this . logger . error ( [ 'Error on upload file to minio' , error ?. message , error ?. stack ] ) ;
11461140 }
11471141 }
@@ -1232,7 +1226,6 @@ export class BaileysStartupService extends ChannelStartupService {
12321226 }
12331227 }
12341228 } catch ( error ) {
1235- this . logger . error ( 'line 1318' ) ;
12361229 this . logger . error ( error ) ;
12371230 }
12381231 } ,
@@ -2020,7 +2013,6 @@ export class BaileysStartupService extends ChannelStartupService {
20202013 data : messageRaw ,
20212014 } ) ;
20222015 } catch ( error ) {
2023- this . logger . error ( 'line 1181' ) ;
20242016 this . logger . error ( [ 'Error on upload file to minio' , error ?. message , error ?. stack ] ) ;
20252017 }
20262018 }
@@ -2056,7 +2048,6 @@ export class BaileysStartupService extends ChannelStartupService {
20562048
20572049 return messageRaw ;
20582050 } catch ( error ) {
2059- this . logger . error ( 'line 2097' ) ;
20602051 this . logger . error ( error ) ;
20612052 throw new BadRequestException ( error . toString ( ) ) ;
20622053 }
@@ -2109,7 +2100,6 @@ export class BaileysStartupService extends ChannelStartupService {
21092100
21102101 return { presence : data . presence } ;
21112102 } catch ( error ) {
2112- this . logger . error ( 'line 2134' ) ;
21132103 this . logger . error ( error ) ;
21142104 throw new BadRequestException ( error . toString ( ) ) ;
21152105 }
@@ -2122,7 +2112,6 @@ export class BaileysStartupService extends ChannelStartupService {
21222112
21232113 return { presence : data . presence } ;
21242114 } catch ( error ) {
2125- this . logger . error ( 'line 2147' ) ;
21262115 this . logger . error ( error ) ;
21272116 throw new BadRequestException ( error . toString ( ) ) ;
21282117 }
@@ -2353,7 +2342,6 @@ export class BaileysStartupService extends ChannelStartupService {
23532342 { userJid : this . instance . wuid } ,
23542343 ) ;
23552344 } catch ( error ) {
2356- this . logger . error ( 'line 2378' ) ;
23572345 this . logger . error ( error ) ;
23582346 throw new InternalServerErrorException ( error ?. toString ( ) || error ) ;
23592347 }
@@ -2395,7 +2383,6 @@ export class BaileysStartupService extends ChannelStartupService {
23952383
23962384 return webpBuffer ;
23972385 } catch ( error ) {
2398- this . logger . error ( 'line 2420' ) ;
23992386 console . error ( 'Erro ao converter a imagem para WebP:' , error ) ;
24002387 throw error ;
24012388 }
@@ -2812,7 +2799,6 @@ export class BaileysStartupService extends ChannelStartupService {
28122799 await this . client . readMessages ( keys ) ;
28132800 return { message : 'Read messages' , read : 'success' } ;
28142801 } catch ( error ) {
2815- this . logger . error ( 'line 2818' ) ;
28162802 throw new InternalServerErrorException ( 'Read messages fail' , error . toString ( ) ) ;
28172803 }
28182804 }
@@ -2878,7 +2864,6 @@ export class BaileysStartupService extends ChannelStartupService {
28782864 archived : true ,
28792865 } ;
28802866 } catch ( error ) {
2881- this . logger . error ( 'line 2884' ) ;
28822867 throw new InternalServerErrorException ( {
28832868 archived : false ,
28842869 message : [ 'An error occurred while archiving the chat. Open a calling.' , error . toString ( ) ] ,
@@ -2916,7 +2901,6 @@ export class BaileysStartupService extends ChannelStartupService {
29162901 markedChatUnread : true ,
29172902 } ;
29182903 } catch ( error ) {
2919- this . logger . error ( 'line 2922' ) ;
29202904 throw new InternalServerErrorException ( {
29212905 markedChatUnread : false ,
29222906 message : [ 'An error occurred while marked unread the chat. Open a calling.' , error . toString ( ) ] ,
@@ -2928,7 +2912,6 @@ export class BaileysStartupService extends ChannelStartupService {
29282912 try {
29292913 return await this . client . sendMessage ( del . remoteJid , { delete : del } ) ;
29302914 } catch ( error ) {
2931- this . logger . error ( 'line 2934' ) ;
29322915 throw new InternalServerErrorException ( 'Error while deleting message for everyone' , error ?. toString ( ) ) ;
29332916 }
29342917 }
@@ -3020,7 +3003,6 @@ export class BaileysStartupService extends ChannelStartupService {
30203003 buffer : getBuffer ? buffer : null ,
30213004 } ;
30223005 } catch ( error ) {
3023- this . logger . error ( 'line 3026' ) ;
30243006 this . logger . error ( error ) ;
30253007 throw new BadRequestException ( error . toString ( ) ) ;
30263008 }
@@ -3062,7 +3044,6 @@ export class BaileysStartupService extends ChannelStartupService {
30623044 } ,
30633045 } ;
30643046 } catch ( error ) {
3065- this . logger . error ( 'line 3068' ) ;
30663047 throw new InternalServerErrorException ( 'Error updating privacy settings' , error . toString ( ) ) ;
30673048 }
30683049 }
@@ -3088,7 +3069,6 @@ export class BaileysStartupService extends ChannelStartupService {
30883069 ...profile ,
30893070 } ;
30903071 } catch ( error ) {
3091- this . logger . error ( 'line 3094' ) ;
30923072 throw new InternalServerErrorException ( 'Error updating profile name' , error . toString ( ) ) ;
30933073 }
30943074 }
@@ -3099,7 +3079,6 @@ export class BaileysStartupService extends ChannelStartupService {
30993079
31003080 return { update : 'success' } ;
31013081 } catch ( error ) {
3102- this . logger . error ( 'line 3105' ) ;
31033082 throw new InternalServerErrorException ( 'Error updating profile name' , error . toString ( ) ) ;
31043083 }
31053084 }
@@ -3110,7 +3089,6 @@ export class BaileysStartupService extends ChannelStartupService {
31103089
31113090 return { update : 'success' } ;
31123091 } catch ( error ) {
3113- this . logger . error ( 'line 3116' ) ;
31143092 throw new InternalServerErrorException ( 'Error updating profile status' , error . toString ( ) ) ;
31153093 }
31163094 }
@@ -3152,7 +3130,6 @@ export class BaileysStartupService extends ChannelStartupService {
31523130
31533131 return { update : 'success' } ;
31543132 } catch ( error ) {
3155- this . logger . error ( 'line 3158' ) ;
31563133 throw new InternalServerErrorException ( 'Error updating profile picture' , error . toString ( ) ) ;
31573134 }
31583135 }
@@ -3165,7 +3142,6 @@ export class BaileysStartupService extends ChannelStartupService {
31653142
31663143 return { update : 'success' } ;
31673144 } catch ( error ) {
3168- this . logger . error ( 'line 3171' ) ;
31693145 throw new InternalServerErrorException ( 'Error removing profile picture' , error . toString ( ) ) ;
31703146 }
31713147 }
@@ -3186,7 +3162,6 @@ export class BaileysStartupService extends ChannelStartupService {
31863162
31873163 return { block : 'success' } ;
31883164 } catch ( error ) {
3189- this . logger . error ( 'line 3192' ) ;
31903165 throw new InternalServerErrorException ( 'Error blocking user' , error . toString ( ) ) ;
31913166 }
31923167 }
@@ -3217,7 +3192,6 @@ export class BaileysStartupService extends ChannelStartupService {
32173192
32183193 return null ;
32193194 } catch ( error ) {
3220- this . logger . error ( 'line 3223' ) ;
32213195 this . logger . error ( error ) ;
32223196 throw new BadRequestException ( error . toString ( ) ) ;
32233197 }
@@ -3239,7 +3213,6 @@ export class BaileysStartupService extends ChannelStartupService {
32393213 edit : data . key ,
32403214 } ) ;
32413215 } catch ( error ) {
3242- this . logger . error ( 'line 3245' ) ;
32433216 this . logger . error ( error ) ;
32443217 throw new BadRequestException ( error . toString ( ) ) ;
32453218 }
@@ -3282,7 +3255,6 @@ export class BaileysStartupService extends ChannelStartupService {
32823255 return { numberJid : contact . jid , labelId : data . labelId , remove : true } ;
32833256 }
32843257 } catch ( error ) {
3285- this . logger . error ( 'line 3288' ) ;
32863258 throw new BadRequestException ( `Unable to ${ data . action } label to chat` , error . toString ( ) ) ;
32873259 }
32883260 }
@@ -3304,7 +3276,6 @@ export class BaileysStartupService extends ChannelStartupService {
33043276
33053277 return meta ;
33063278 } catch ( error ) {
3307- this . logger . error ( 'line 3310' ) ;
33083279 this . logger . error ( error ) ;
33093280 return null ;
33103281 }
@@ -3357,7 +3328,6 @@ export class BaileysStartupService extends ChannelStartupService {
33573328
33583329 return group ;
33593330 } catch ( error ) {
3360- this . logger . error ( 'line 3363' ) ;
33613331 this . logger . error ( error ) ;
33623332 throw new InternalServerErrorException ( 'Error creating group' , error . toString ( ) ) ;
33633333 }
@@ -3397,7 +3367,6 @@ export class BaileysStartupService extends ChannelStartupService {
33973367
33983368 return { update : 'success' } ;
33993369 } catch ( error ) {
3400- this . logger . error ( 'line 3403' ) ;
34013370 throw new InternalServerErrorException ( 'Error update group picture' , error . toString ( ) ) ;
34023371 }
34033372 }
@@ -3408,7 +3377,6 @@ export class BaileysStartupService extends ChannelStartupService {
34083377
34093378 return { update : 'success' } ;
34103379 } catch ( error ) {
3411- this . logger . error ( 'line 3414' ) ;
34123380 throw new InternalServerErrorException ( 'Error updating group subject' , error . toString ( ) ) ;
34133381 }
34143382 }
@@ -3419,7 +3387,6 @@ export class BaileysStartupService extends ChannelStartupService {
34193387
34203388 return { update : 'success' } ;
34213389 } catch ( error ) {
3422- this . logger . error ( 'line 3425' ) ;
34233390 throw new InternalServerErrorException ( 'Error updating group description' , error . toString ( ) ) ;
34243391 }
34253392 }
@@ -3454,7 +3421,6 @@ export class BaileysStartupService extends ChannelStartupService {
34543421 if ( reply === 'inner' ) {
34553422 return ;
34563423 }
3457- this . logger . error ( 'line 3460' ) ;
34583424 throw new NotFoundException ( 'Error fetching group' , error . toString ( ) ) ;
34593425 }
34603426 }
@@ -3496,7 +3462,6 @@ export class BaileysStartupService extends ChannelStartupService {
34963462 const code = await this . client . groupInviteCode ( id . groupJid ) ;
34973463 return { inviteUrl : `https://chat.whatsapp.com/${ code } ` , inviteCode : code } ;
34983464 } catch ( error ) {
3499- this . logger . error ( 'line 3502' ) ;
35003465 throw new NotFoundException ( 'No invite code' , error . toString ( ) ) ;
35013466 }
35023467 }
@@ -3505,7 +3470,6 @@ export class BaileysStartupService extends ChannelStartupService {
35053470 try {
35063471 return await this . client . groupGetInviteInfo ( id . inviteCode ) ;
35073472 } catch ( error ) {
3508- this . logger . error ( 'line 3511' ) ;
35093473 throw new NotFoundException ( 'No invite info' , id . inviteCode ) ;
35103474 }
35113475 }
@@ -3531,7 +3495,6 @@ export class BaileysStartupService extends ChannelStartupService {
35313495
35323496 return { send : true , inviteUrl } ;
35333497 } catch ( error ) {
3534- this . logger . error ( 'line 3537' ) ;
35353498 throw new NotFoundException ( 'No send invite' ) ;
35363499 }
35373500 }
@@ -3541,7 +3504,6 @@ export class BaileysStartupService extends ChannelStartupService {
35413504 const groupJid = await this . client . groupAcceptInvite ( id . inviteCode ) ;
35423505 return { accepted : true , groupJid : groupJid } ;
35433506 } catch ( error ) {
3544- this . logger . error ( 'line 3547' ) ;
35453507 throw new NotFoundException ( 'Accept invite error' , error . toString ( ) ) ;
35463508 }
35473509 }
@@ -3551,7 +3513,6 @@ export class BaileysStartupService extends ChannelStartupService {
35513513 const inviteCode = await this . client . groupRevokeInvite ( id . groupJid ) ;
35523514 return { revoked : true , inviteCode } ;
35533515 } catch ( error ) {
3554- this . logger . error ( 'line 3557' ) ;
35553516 throw new NotFoundException ( 'Revoke error' , error . toString ( ) ) ;
35563517 }
35573518 }
@@ -3584,7 +3545,6 @@ export class BaileysStartupService extends ChannelStartupService {
35843545 return { participants : parsedParticipants } ;
35853546 } catch ( error ) {
35863547 console . error ( error ) ;
3587- this . logger . error ( 'line 3583' ) ;
35883548 throw new NotFoundException ( 'No participants' , error . toString ( ) ) ;
35893549 }
35903550 }
@@ -3599,7 +3559,6 @@ export class BaileysStartupService extends ChannelStartupService {
35993559 ) ;
36003560 return { updateParticipants : updateParticipants } ;
36013561 } catch ( error ) {
3602- this . logger . error ( 'line 3598' ) ;
36033562 throw new BadRequestException ( 'Error updating participants' , error . toString ( ) ) ;
36043563 }
36053564 }
@@ -3609,7 +3568,6 @@ export class BaileysStartupService extends ChannelStartupService {
36093568 const updateSetting = await this . client . groupSettingUpdate ( update . groupJid , update . action ) ;
36103569 return { updateSetting : updateSetting } ;
36113570 } catch ( error ) {
3612- this . logger . error ( 'line 3608' ) ;
36133571 throw new BadRequestException ( 'Error updating setting' , error . toString ( ) ) ;
36143572 }
36153573 }
@@ -3619,7 +3577,6 @@ export class BaileysStartupService extends ChannelStartupService {
36193577 await this . client . groupToggleEphemeral ( update . groupJid , update . expiration ) ;
36203578 return { success : true } ;
36213579 } catch ( error ) {
3622- this . logger . error ( 'line 3618' ) ;
36233580 throw new BadRequestException ( 'Error updating setting' , error . toString ( ) ) ;
36243581 }
36253582 }
@@ -3629,7 +3586,6 @@ export class BaileysStartupService extends ChannelStartupService {
36293586 await this . client . groupLeave ( id . groupJid ) ;
36303587 return { groupJid : id . groupJid , leave : true } ;
36313588 } catch ( error ) {
3632- this . logger . error ( 'line 3628' ) ;
36333589 throw new BadRequestException ( 'Unable to leave the group' , error . toString ( ) ) ;
36343590 }
36353591 }
@@ -3643,6 +3599,7 @@ export class BaileysStartupService extends ChannelStartupService {
36433599 const messageRaw = {
36443600 key : message . key ,
36453601 pushName : message . pushName ,
3602+ status : message . status ,
36463603 message : { ...message . message } ,
36473604 contextInfo : contentMsg ?. contextInfo ,
36483605 messageType : getContentType ( message . message ) || 'unknown' ,
@@ -3657,6 +3614,12 @@ export class BaileysStartupService extends ChannelStartupService {
36573614 delete messageRaw . message . extendedTextMessage ;
36583615 }
36593616
3617+ if ( messageRaw . message . documentWithCaptionMessage ) {
3618+ messageRaw . messageType = 'documentMessage' ;
3619+ messageRaw . message . documentMessage = messageRaw . message . documentWithCaptionMessage . message . documentMessage ;
3620+ delete messageRaw . message . documentWithCaptionMessage ;
3621+ }
3622+
36603623 return messageRaw ;
36613624 }
36623625}
0 commit comments