@@ -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 }
@@ -758,7 +755,6 @@ export class BaileysStartupService extends ChannelStartupService {
758755 }
759756 } catch ( error ) {
760757 console . error ( error ) ;
761- this . logger . error ( 'line 817' ) ;
762758 this . logger . error ( `Error: ${ error . message } ` ) ;
763759 }
764760 } ,
@@ -948,7 +944,6 @@ export class BaileysStartupService extends ChannelStartupService {
948944 messages = undefined ;
949945 chats = undefined ;
950946 } catch ( error ) {
951- this . logger . error ( 'line 1011' ) ;
952947 this . logger . error ( error ) ;
953948 }
954949 } ,
@@ -1136,7 +1131,6 @@ export class BaileysStartupService extends ChannelStartupService {
11361131 data : messageRaw ,
11371132 } ) ;
11381133 } catch ( error ) {
1139- this . logger . error ( 'line 1181' ) ;
11401134 this . logger . error ( [ 'Error on upload file to minio' , error ?. message , error ?. stack ] ) ;
11411135 }
11421136 }
@@ -1227,7 +1221,6 @@ export class BaileysStartupService extends ChannelStartupService {
12271221 }
12281222 }
12291223 } catch ( error ) {
1230- this . logger . error ( 'line 1318' ) ;
12311224 this . logger . error ( error ) ;
12321225 }
12331226 } ,
@@ -2015,7 +2008,6 @@ export class BaileysStartupService extends ChannelStartupService {
20152008 data : messageRaw ,
20162009 } ) ;
20172010 } catch ( error ) {
2018- this . logger . error ( 'line 1181' ) ;
20192011 this . logger . error ( [ 'Error on upload file to minio' , error ?. message , error ?. stack ] ) ;
20202012 }
20212013 }
@@ -2051,7 +2043,6 @@ export class BaileysStartupService extends ChannelStartupService {
20512043
20522044 return messageRaw ;
20532045 } catch ( error ) {
2054- this . logger . error ( 'line 2097' ) ;
20552046 this . logger . error ( error ) ;
20562047 throw new BadRequestException ( error . toString ( ) ) ;
20572048 }
@@ -2104,7 +2095,6 @@ export class BaileysStartupService extends ChannelStartupService {
21042095
21052096 return { presence : data . presence } ;
21062097 } catch ( error ) {
2107- this . logger . error ( 'line 2134' ) ;
21082098 this . logger . error ( error ) ;
21092099 throw new BadRequestException ( error . toString ( ) ) ;
21102100 }
@@ -2117,7 +2107,6 @@ export class BaileysStartupService extends ChannelStartupService {
21172107
21182108 return { presence : data . presence } ;
21192109 } catch ( error ) {
2120- this . logger . error ( 'line 2147' ) ;
21212110 this . logger . error ( error ) ;
21222111 throw new BadRequestException ( error . toString ( ) ) ;
21232112 }
@@ -2348,7 +2337,6 @@ export class BaileysStartupService extends ChannelStartupService {
23482337 { userJid : this . instance . wuid } ,
23492338 ) ;
23502339 } catch ( error ) {
2351- this . logger . error ( 'line 2378' ) ;
23522340 this . logger . error ( error ) ;
23532341 throw new InternalServerErrorException ( error ?. toString ( ) || error ) ;
23542342 }
@@ -2390,7 +2378,6 @@ export class BaileysStartupService extends ChannelStartupService {
23902378
23912379 return webpBuffer ;
23922380 } catch ( error ) {
2393- this . logger . error ( 'line 2420' ) ;
23942381 console . error ( 'Erro ao converter a imagem para WebP:' , error ) ;
23952382 throw error ;
23962383 }
@@ -2807,7 +2794,6 @@ export class BaileysStartupService extends ChannelStartupService {
28072794 await this . client . readMessages ( keys ) ;
28082795 return { message : 'Read messages' , read : 'success' } ;
28092796 } catch ( error ) {
2810- this . logger . error ( 'line 2818' ) ;
28112797 throw new InternalServerErrorException ( 'Read messages fail' , error . toString ( ) ) ;
28122798 }
28132799 }
@@ -2873,7 +2859,6 @@ export class BaileysStartupService extends ChannelStartupService {
28732859 archived : true ,
28742860 } ;
28752861 } catch ( error ) {
2876- this . logger . error ( 'line 2884' ) ;
28772862 throw new InternalServerErrorException ( {
28782863 archived : false ,
28792864 message : [ 'An error occurred while archiving the chat. Open a calling.' , error . toString ( ) ] ,
@@ -2911,7 +2896,6 @@ export class BaileysStartupService extends ChannelStartupService {
29112896 markedChatUnread : true ,
29122897 } ;
29132898 } catch ( error ) {
2914- this . logger . error ( 'line 2922' ) ;
29152899 throw new InternalServerErrorException ( {
29162900 markedChatUnread : false ,
29172901 message : [ 'An error occurred while marked unread the chat. Open a calling.' , error . toString ( ) ] ,
@@ -2923,7 +2907,6 @@ export class BaileysStartupService extends ChannelStartupService {
29232907 try {
29242908 return await this . client . sendMessage ( del . remoteJid , { delete : del } ) ;
29252909 } catch ( error ) {
2926- this . logger . error ( 'line 2934' ) ;
29272910 throw new InternalServerErrorException ( 'Error while deleting message for everyone' , error ?. toString ( ) ) ;
29282911 }
29292912 }
@@ -3015,7 +2998,6 @@ export class BaileysStartupService extends ChannelStartupService {
30152998 buffer : getBuffer ? buffer : null ,
30162999 } ;
30173000 } catch ( error ) {
3018- this . logger . error ( 'line 3026' ) ;
30193001 this . logger . error ( error ) ;
30203002 throw new BadRequestException ( error . toString ( ) ) ;
30213003 }
@@ -3057,7 +3039,6 @@ export class BaileysStartupService extends ChannelStartupService {
30573039 } ,
30583040 } ;
30593041 } catch ( error ) {
3060- this . logger . error ( 'line 3068' ) ;
30613042 throw new InternalServerErrorException ( 'Error updating privacy settings' , error . toString ( ) ) ;
30623043 }
30633044 }
@@ -3083,7 +3064,6 @@ export class BaileysStartupService extends ChannelStartupService {
30833064 ...profile ,
30843065 } ;
30853066 } catch ( error ) {
3086- this . logger . error ( 'line 3094' ) ;
30873067 throw new InternalServerErrorException ( 'Error updating profile name' , error . toString ( ) ) ;
30883068 }
30893069 }
@@ -3094,7 +3074,6 @@ export class BaileysStartupService extends ChannelStartupService {
30943074
30953075 return { update : 'success' } ;
30963076 } catch ( error ) {
3097- this . logger . error ( 'line 3105' ) ;
30983077 throw new InternalServerErrorException ( 'Error updating profile name' , error . toString ( ) ) ;
30993078 }
31003079 }
@@ -3105,7 +3084,6 @@ export class BaileysStartupService extends ChannelStartupService {
31053084
31063085 return { update : 'success' } ;
31073086 } catch ( error ) {
3108- this . logger . error ( 'line 3116' ) ;
31093087 throw new InternalServerErrorException ( 'Error updating profile status' , error . toString ( ) ) ;
31103088 }
31113089 }
@@ -3147,7 +3125,6 @@ export class BaileysStartupService extends ChannelStartupService {
31473125
31483126 return { update : 'success' } ;
31493127 } catch ( error ) {
3150- this . logger . error ( 'line 3158' ) ;
31513128 throw new InternalServerErrorException ( 'Error updating profile picture' , error . toString ( ) ) ;
31523129 }
31533130 }
@@ -3160,7 +3137,6 @@ export class BaileysStartupService extends ChannelStartupService {
31603137
31613138 return { update : 'success' } ;
31623139 } catch ( error ) {
3163- this . logger . error ( 'line 3171' ) ;
31643140 throw new InternalServerErrorException ( 'Error removing profile picture' , error . toString ( ) ) ;
31653141 }
31663142 }
@@ -3181,7 +3157,6 @@ export class BaileysStartupService extends ChannelStartupService {
31813157
31823158 return { block : 'success' } ;
31833159 } catch ( error ) {
3184- this . logger . error ( 'line 3192' ) ;
31853160 throw new InternalServerErrorException ( 'Error blocking user' , error . toString ( ) ) ;
31863161 }
31873162 }
@@ -3212,7 +3187,6 @@ export class BaileysStartupService extends ChannelStartupService {
32123187
32133188 return null ;
32143189 } catch ( error ) {
3215- this . logger . error ( 'line 3223' ) ;
32163190 this . logger . error ( error ) ;
32173191 throw new BadRequestException ( error . toString ( ) ) ;
32183192 }
@@ -3234,7 +3208,6 @@ export class BaileysStartupService extends ChannelStartupService {
32343208 edit : data . key ,
32353209 } ) ;
32363210 } catch ( error ) {
3237- this . logger . error ( 'line 3245' ) ;
32383211 this . logger . error ( error ) ;
32393212 throw new BadRequestException ( error . toString ( ) ) ;
32403213 }
@@ -3277,7 +3250,6 @@ export class BaileysStartupService extends ChannelStartupService {
32773250 return { numberJid : contact . jid , labelId : data . labelId , remove : true } ;
32783251 }
32793252 } catch ( error ) {
3280- this . logger . error ( 'line 3288' ) ;
32813253 throw new BadRequestException ( `Unable to ${ data . action } label to chat` , error . toString ( ) ) ;
32823254 }
32833255 }
@@ -3299,7 +3271,6 @@ export class BaileysStartupService extends ChannelStartupService {
32993271
33003272 return meta ;
33013273 } catch ( error ) {
3302- this . logger . error ( 'line 3310' ) ;
33033274 this . logger . error ( error ) ;
33043275 return null ;
33053276 }
@@ -3352,7 +3323,6 @@ export class BaileysStartupService extends ChannelStartupService {
33523323
33533324 return group ;
33543325 } catch ( error ) {
3355- this . logger . error ( 'line 3363' ) ;
33563326 this . logger . error ( error ) ;
33573327 throw new InternalServerErrorException ( 'Error creating group' , error . toString ( ) ) ;
33583328 }
@@ -3392,7 +3362,6 @@ export class BaileysStartupService extends ChannelStartupService {
33923362
33933363 return { update : 'success' } ;
33943364 } catch ( error ) {
3395- this . logger . error ( 'line 3403' ) ;
33963365 throw new InternalServerErrorException ( 'Error update group picture' , error . toString ( ) ) ;
33973366 }
33983367 }
@@ -3403,7 +3372,6 @@ export class BaileysStartupService extends ChannelStartupService {
34033372
34043373 return { update : 'success' } ;
34053374 } catch ( error ) {
3406- this . logger . error ( 'line 3414' ) ;
34073375 throw new InternalServerErrorException ( 'Error updating group subject' , error . toString ( ) ) ;
34083376 }
34093377 }
@@ -3414,7 +3382,6 @@ export class BaileysStartupService extends ChannelStartupService {
34143382
34153383 return { update : 'success' } ;
34163384 } catch ( error ) {
3417- this . logger . error ( 'line 3425' ) ;
34183385 throw new InternalServerErrorException ( 'Error updating group description' , error . toString ( ) ) ;
34193386 }
34203387 }
@@ -3449,7 +3416,6 @@ export class BaileysStartupService extends ChannelStartupService {
34493416 if ( reply === 'inner' ) {
34503417 return ;
34513418 }
3452- this . logger . error ( 'line 3460' ) ;
34533419 throw new NotFoundException ( 'Error fetching group' , error . toString ( ) ) ;
34543420 }
34553421 }
@@ -3491,7 +3457,6 @@ export class BaileysStartupService extends ChannelStartupService {
34913457 const code = await this . client . groupInviteCode ( id . groupJid ) ;
34923458 return { inviteUrl : `https://chat.whatsapp.com/${ code } ` , inviteCode : code } ;
34933459 } catch ( error ) {
3494- this . logger . error ( 'line 3502' ) ;
34953460 throw new NotFoundException ( 'No invite code' , error . toString ( ) ) ;
34963461 }
34973462 }
@@ -3500,7 +3465,6 @@ export class BaileysStartupService extends ChannelStartupService {
35003465 try {
35013466 return await this . client . groupGetInviteInfo ( id . inviteCode ) ;
35023467 } catch ( error ) {
3503- this . logger . error ( 'line 3511' ) ;
35043468 throw new NotFoundException ( 'No invite info' , id . inviteCode ) ;
35053469 }
35063470 }
@@ -3526,7 +3490,6 @@ export class BaileysStartupService extends ChannelStartupService {
35263490
35273491 return { send : true , inviteUrl } ;
35283492 } catch ( error ) {
3529- this . logger . error ( 'line 3537' ) ;
35303493 throw new NotFoundException ( 'No send invite' ) ;
35313494 }
35323495 }
@@ -3536,7 +3499,6 @@ export class BaileysStartupService extends ChannelStartupService {
35363499 const groupJid = await this . client . groupAcceptInvite ( id . inviteCode ) ;
35373500 return { accepted : true , groupJid : groupJid } ;
35383501 } catch ( error ) {
3539- this . logger . error ( 'line 3547' ) ;
35403502 throw new NotFoundException ( 'Accept invite error' , error . toString ( ) ) ;
35413503 }
35423504 }
@@ -3546,7 +3508,6 @@ export class BaileysStartupService extends ChannelStartupService {
35463508 const inviteCode = await this . client . groupRevokeInvite ( id . groupJid ) ;
35473509 return { revoked : true , inviteCode } ;
35483510 } catch ( error ) {
3549- this . logger . error ( 'line 3557' ) ;
35503511 throw new NotFoundException ( 'Revoke error' , error . toString ( ) ) ;
35513512 }
35523513 }
@@ -3579,7 +3540,6 @@ export class BaileysStartupService extends ChannelStartupService {
35793540 return { participants : parsedParticipants } ;
35803541 } catch ( error ) {
35813542 console . error ( error ) ;
3582- this . logger . error ( 'line 3583' ) ;
35833543 throw new NotFoundException ( 'No participants' , error . toString ( ) ) ;
35843544 }
35853545 }
@@ -3594,7 +3554,6 @@ export class BaileysStartupService extends ChannelStartupService {
35943554 ) ;
35953555 return { updateParticipants : updateParticipants } ;
35963556 } catch ( error ) {
3597- this . logger . error ( 'line 3598' ) ;
35983557 throw new BadRequestException ( 'Error updating participants' , error . toString ( ) ) ;
35993558 }
36003559 }
@@ -3604,7 +3563,6 @@ export class BaileysStartupService extends ChannelStartupService {
36043563 const updateSetting = await this . client . groupSettingUpdate ( update . groupJid , update . action ) ;
36053564 return { updateSetting : updateSetting } ;
36063565 } catch ( error ) {
3607- this . logger . error ( 'line 3608' ) ;
36083566 throw new BadRequestException ( 'Error updating setting' , error . toString ( ) ) ;
36093567 }
36103568 }
@@ -3614,7 +3572,6 @@ export class BaileysStartupService extends ChannelStartupService {
36143572 await this . client . groupToggleEphemeral ( update . groupJid , update . expiration ) ;
36153573 return { success : true } ;
36163574 } catch ( error ) {
3617- this . logger . error ( 'line 3618' ) ;
36183575 throw new BadRequestException ( 'Error updating setting' , error . toString ( ) ) ;
36193576 }
36203577 }
@@ -3624,7 +3581,6 @@ export class BaileysStartupService extends ChannelStartupService {
36243581 await this . client . groupLeave ( id . groupJid ) ;
36253582 return { groupJid : id . groupJid , leave : true } ;
36263583 } catch ( error ) {
3627- this . logger . error ( 'line 3628' ) ;
36283584 throw new BadRequestException ( 'Unable to leave the group' , error . toString ( ) ) ;
36293585 }
36303586 }
@@ -3638,6 +3594,7 @@ export class BaileysStartupService extends ChannelStartupService {
36383594 const messageRaw = {
36393595 key : message . key ,
36403596 pushName : message . pushName ,
3597+ status : message . status ,
36413598 message : { ...message . message } ,
36423599 contextInfo : contentMsg ?. contextInfo ,
36433600 messageType : getContentType ( message . message ) || 'unknown' ,
@@ -3652,6 +3609,12 @@ export class BaileysStartupService extends ChannelStartupService {
36523609 delete messageRaw . message . extendedTextMessage ;
36533610 }
36543611
3612+ if ( messageRaw . message . documentWithCaptionMessage ) {
3613+ messageRaw . messageType = 'documentMessage' ;
3614+ messageRaw . message . documentMessage = messageRaw . message . documentWithCaptionMessage . message . documentMessage ;
3615+ delete messageRaw . message . documentWithCaptionMessage ;
3616+ }
3617+
36553618 return messageRaw ;
36563619 }
36573620}
0 commit comments