Guides

Poll ManagementUSER-ONLY

User Walkthrough 33 of 50

Users can vote in polls and manage poll options.

Voting

vote selects poll options, and retractVote retracts the selection.

await client.vote(chatId, messageId, [0]);
await client.retractVote(chatId, messageId);

Listing Voters

getPollVoters lists voters for a non-anonymous poll option.

const voters = await client.getPollVoters(chatId, messageId, {
  optionIndex: 0,
});

Managing Options

Polls that allow suggestions accept new options with addPollOption and remove them with removePollOption.

await client.addPollOption(chatId, messageId, {
  text: "Another option",
});
await client.removePollOption(chatId, messageId, optionIndex);