@@ -2,7 +2,7 @@ import { default as mime } from 'mime-types';
22import { Page , EvaluateFunc , PageEvent } from 'puppeteer' ;
33import { Chat , LiveLocationChangedEvent , ChatState , ChatMuteDuration , GroupChatCreationResponse , EphemeralDuration } from './model/chat' ;
44import { BusinessProfile , Contact , NumberCheck } from './model/contact' ;
5- import { Message , MessageInfo , PollData } from './model/message' ;
5+ import { Message , MessageInfo , MessagePinDuration , PollData } from './model/message' ;
66import { default as axios , AxiosRequestConfig } from 'axios' ;
77import { NewCommunityGroup , ParticipantChangedEventModel , GenericGroupChangeEvent , GroupMetadata } from './model/group-metadata' ;
88import { useragent } from '../config/puppeteer.config'
@@ -273,6 +273,7 @@ declare module WAPI {
273273 const simulateRecording : ( to : string , on : boolean ) => Promise < boolean > ;
274274 const archiveChat : ( id : string , archive : boolean ) => Promise < boolean > ;
275275 const pinChat : ( id : string , pin : boolean ) => Promise < boolean > ;
276+ const pinMessage : ( id : string , pin : boolean , pinDuration : string ) => Promise < boolean > ;
276277 const markAllRead : ( ) => Boolean ;
277278 const isConnected : ( ) => Boolean ;
278279 const logout : ( ) => Boolean ;
@@ -2441,7 +2442,7 @@ public async testCallback(callbackToTest: SimpleListener, testData: any) : Prom
24412442 * Pin/Unpin chats
24422443 *
24432444 * @param id The id of the conversation
2444- * @param archive boolean true => pin, false => unpin
2445+ * @param pin boolean true => pin, false => unpin
24452446 * @return boolean true: worked
24462447 */
24472448 public async pinChat ( id : ChatId , pin : boolean ) : Promise < boolean > {
@@ -2451,6 +2452,20 @@ public async testCallback(callbackToTest: SimpleListener, testData: any) : Prom
24512452 ) as Promise < boolean > ;
24522453 }
24532454
2455+ /**
2456+ * Pin/Unpin message
2457+ *
2458+ * @param id The id of the message
2459+ * @param pin boolean true => pin, false => unpin
2460+ * @param pinDuration The length of time to pin the message. Default `ThirtyDays`
2461+ * @return boolean true: worked
2462+ */
2463+ public async pinMessage ( id : MessageId , pin : boolean , pinDuration : MessagePinDuration = "ThirtyDays" ) : Promise < boolean > {
2464+ return await this . pup (
2465+ ( { id, pin, pinDuration } ) => WAPI . pinMessage ( id , pin , pinDuration ) ,
2466+ { id, pin, pinDuration }
2467+ ) as Promise < boolean > ;
2468+ }
24542469
24552470 /**
24562471 *
0 commit comments