diff --git a/src/api/layers/retriever.layer.ts b/src/api/layers/retriever.layer.ts index c538e6c3e..39c8a520f 100644 --- a/src/api/layers/retriever.layer.ts +++ b/src/api/layers/retriever.layer.ts @@ -24,6 +24,7 @@ import { ContactStatus, ProfilePicThumbObj, WhatsappProfile, + Wid, } from '../model'; import { SenderLayer } from './sender.layer'; @@ -448,4 +449,61 @@ export class RetrieverLayer extends SenderLayer { msgId ); } + + /** + * Get the reactions of a message + * + * @category Chat + */ + public async getReactions(msgId: string): Promise<{ + reactionByMe: { + id: any; + orphan: number; + msgId: any; + reactionText: string; + read: boolean; + senderUserJid: string; + timestamp: number; + }; + reactions: { + aggregateEmoji: string; + hasReactionByMe: boolean; + senders: { + id: any; + orphan: number; + msgId: any; + reactionText: string; + read: boolean; + senderUserJid: string; + timestamp: number; + }[]; + }[]; + }> { + return await evaluateAndReturn( + this.page, + (msgId: string) => WPP.chat.getReactions(msgId), + msgId + ); + } + + /** + * Get the votes of a poll message + * + * @category Chat + */ + public async getVotes(msgId: string): Promise<{ + msgId: any; + chatId: Wid; + votes: { + selectedOptions: number[]; + timestamp: number; + sender: Wid; + }[]; + }> { + return await evaluateAndReturn( + this.page, + (msgId: string) => WPP.chat.getVotes(msgId), + msgId + ); + } }