feat+fix: send vote messages & vote update event (#3913)
* add send vote function * Update index.d.ts * fix and add required modules * fix poll update in group chat * adjustments to improvements * add example usages * fix eslint --------- Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
This commit is contained in:
parent
05f651b521
commit
0c36613cc7
2 changed files with 51 additions and 11 deletions
|
|
@ -103,7 +103,8 @@ exports.ExposeStore = () => {
|
|||
window.Store.FindOrCreateChat = window.require('WAWebFindChatAction');
|
||||
window.Store.CustomerNoteUtils = window.require('WAWebNoteAction');
|
||||
window.Store.BusinessGatingUtils = window.require('WAWebBizGatingUtils');
|
||||
window.Store.PollsVotesSchema = require('WAWebPollsVotesSchema');
|
||||
window.Store.PollsVotesSchema = window.require('WAWebPollsVotesSchema');
|
||||
window.Store.PollsSendVote = window.require('WAWebPollsSendVoteMsgAction');
|
||||
|
||||
window.Store.Settings = {
|
||||
...window.require('WAWebUserPrefsGeneral'),
|
||||
|
|
|
|||
|
|
@ -92,15 +92,15 @@ exports.LoadUtils = () => {
|
|||
delete options.location;
|
||||
}
|
||||
|
||||
let _pollOptions = {};
|
||||
let pollOptions = {};
|
||||
if (options.poll) {
|
||||
const { pollName, pollOptions } = options.poll;
|
||||
const { pollName, pollOptions: _pollOptions } = options.poll;
|
||||
const { allowMultipleAnswers, messageSecret } = options.poll.options;
|
||||
_pollOptions = {
|
||||
pollOptions = {
|
||||
kind: 'pollCreation',
|
||||
type: 'poll_creation',
|
||||
pollName: pollName,
|
||||
pollOptions: pollOptions,
|
||||
pollOptions: _pollOptions,
|
||||
pollSelectableOptionsCount: allowMultipleAnswers ? 0 : 1,
|
||||
messageSecret:
|
||||
Array.isArray(messageSecret) && messageSecret.length === 32
|
||||
|
|
@ -264,7 +264,7 @@ exports.LoadUtils = () => {
|
|||
id: newMsgKey,
|
||||
ack: 0,
|
||||
body: content,
|
||||
from: meUser,
|
||||
from: from,
|
||||
to: chat.id,
|
||||
local: true,
|
||||
self: 'out',
|
||||
|
|
@ -276,7 +276,7 @@ exports.LoadUtils = () => {
|
|||
...(mediaOptions.toJSON ? mediaOptions.toJSON() : {}),
|
||||
...quotedMsgOptions,
|
||||
...locationOptions,
|
||||
..._pollOptions,
|
||||
...pollOptions,
|
||||
...eventOptions,
|
||||
...vcardOptions,
|
||||
...buttonOptions,
|
||||
|
|
|
|||
Loading…
Reference in a new issue