fix: get poll request from getAggregateVotesInPollMessage in v1 v2 v3 (#74)

This commit is contained in:
Andres Aya
2023-05-16 12:35:01 -05:00
committed by GitHub
parent 9434e12730
commit 7f60f163e6

View File

@@ -748,7 +748,7 @@ export function getAggregateVotesInPollMessage(
{ message, pollUpdates }: Pick<WAMessage, 'pollUpdates' | 'message'>,
meId?: string
) {
const opts = message?.pollCreationMessage?.options || []
const opts = message?.pollCreationMessage?.options || message?.pollCreationMessageV2?.options || message?.pollCreationMessageV3?.options || []
const voteHashMap = opts.reduce((acc, opt) => {
const hash = sha256(Buffer.from(opt.optionName || '')).toString()
acc[hash] = {