Skip to content

Commit

Permalink
feat: Added getVotes and getReactions functions
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta committed Dec 15, 2022
1 parent 15ebdfc commit 49bb58f
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/api/layers/retriever.layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
ContactStatus,
ProfilePicThumbObj,
WhatsappProfile,
Wid,
} from '../model';
import { SenderLayer } from './sender.layer';

Expand Down Expand Up @@ -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
);
}
}

0 comments on commit 49bb58f

Please sign in to comment.