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:
RendyCraft047 2025-11-10 02:37:51 +07:00 • committed by GitHub
commit 0c36613cc7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 51 additions and 11 deletions

View file

@ -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,