@@ -36,6 +36,7 @@ import {
3636 Options ,
3737 SendAudioDto ,
3838 SendContactDto ,
39+ SendListDto ,
3940 SendLocationDto ,
4041 SendMediaDto ,
4142 SendPollDto ,
@@ -807,8 +808,8 @@ export class BaileysStartupService extends ChannelStartupService {
807808 {
808809 messages,
809810 type,
810- } : // requestId,
811- {
811+ requestId,
812+ } : {
812813 messages : proto . IWebMessageInfo [ ] ;
813814 type : MessageUpsertType ;
814815 requestId ?: string ;
@@ -817,20 +818,20 @@ export class BaileysStartupService extends ChannelStartupService {
817818 ) => {
818819 try {
819820 for ( const received of messages ) {
820- // if (received.message?.conversation || received.message?.extendedTextMessage?.text) {
821- // const text = received.message?.conversation || received.message?.extendedTextMessage?.text;
822- // if (text == 'requestPlaceholder' && !requestId) {
823- // const messageId = await this.client.requestPlaceholderResend(received.key);
824- // console.log('requested placeholder resync, id=', messageId);
825- // } else if (requestId) {
826- // console.log('Message received from phone, id=', requestId, received);
827- // }
828-
829- // if (text == 'onDemandHistSync') {
830- // const messageId = await this.client.fetchMessageHistory(50, received.key, received.messageTimestamp!);
831- // console.log('requested on-demand sync, id=', messageId);
832- // }
833- // }
821+ if ( received . message ?. conversation || received . message ?. extendedTextMessage ?. text ) {
822+ const text = received . message ?. conversation || received . message ?. extendedTextMessage ?. text ;
823+ if ( text == 'requestPlaceholder' && ! requestId ) {
824+ const messageId = await this . client . requestPlaceholderResend ( received . key ) ;
825+ console . log ( 'requested placeholder resync, id=' , messageId ) ;
826+ } else if ( requestId ) {
827+ console . log ( 'Message received from phone, id=' , requestId , received ) ;
828+ }
829+
830+ if ( text == 'onDemandHistSync' ) {
831+ const messageId = await this . client . fetchMessageHistory ( 50 , received . key , received . messageTimestamp ! ) ;
832+ console . log ( 'requested on-demand sync, id=' , messageId ) ;
833+ }
834+ }
834835
835836 if ( received . message ?. protocolMessage ?. editedMessage || received . message ?. editedMessage ?. message ) {
836837 const editedMessage =
@@ -2067,10 +2068,6 @@ export class BaileysStartupService extends ChannelStartupService {
20672068 ) ;
20682069 }
20692070
2070- public async buttonMessage ( ) {
2071- throw new BadRequestException ( 'Method not available on WhatsApp Baileys' ) ;
2072- }
2073-
20742071 public async locationMessage ( data : SendLocationDto ) {
20752072 return await this . sendMessageWithTyping (
20762073 data . number ,
@@ -2092,10 +2089,33 @@ export class BaileysStartupService extends ChannelStartupService {
20922089 ) ;
20932090 }
20942091
2095- public async listMessage ( ) {
2092+ public async buttonMessage ( ) {
20962093 throw new BadRequestException ( 'Method not available on WhatsApp Baileys' ) ;
20972094 }
20982095
2096+ public async listMessage ( data : SendListDto ) {
2097+ return await this . sendMessageWithTyping (
2098+ data . number ,
2099+ {
2100+ listMessage : {
2101+ title : data . title ,
2102+ description : data . description ,
2103+ buttonText : data ?. buttonText ,
2104+ footerText : data ?. footerText ,
2105+ sections : data . sections ,
2106+ listType : 2 ,
2107+ } ,
2108+ } ,
2109+ {
2110+ delay : data ?. delay ,
2111+ presence : 'composing' ,
2112+ quoted : data ?. quoted ,
2113+ mentionsEveryOne : data ?. mentionsEveryOne ,
2114+ mentioned : data ?. mentioned ,
2115+ } ,
2116+ ) ;
2117+ }
2118+
20992119 public async contactMessage ( data : SendContactDto ) {
21002120 const message : proto . IMessage = { } ;
21012121
0 commit comments