Skip to content

[FEATURE] Duplicate #1813

@XieJiSS

Description

@XieJiSS

Is your feature request related to a problem? Please describe.

Bot-created identified poll will receive pollAnswer updates from the Telegram server when users submit their choices (or retract their votes), which contain info about the voter (name, uid, etc.).

Describe the solution you'd like

Create a pollAnswer class and implement related methods.

"poll_answer": {
    "poll_id": "0000000000000000000",
    "user": {
      "id": 000000000,
      "is_bot": false,
      "first_name": "first name",
      "last_name": "last name",
      "username": "username",
      "language_code": "en"
    },
    "option_ids": [ 0 ]
  }

P.S. option_ids might be [] when a user retract his/her vote, or [0, 1] for a multiple-choice poll

Describe alternatives you've considered

PollOption class has a voters property, but that only indicates the number of voters of an option. By maintaining a hash table (or something like that) in the memory and updating it every time a poll_answer update was fetched, a bot could actually know the exact status of a poll (of course, the poll can't be an anonymous one).

This feature could be extremely useful if we need to create a weighted vote, where different voters have different weights according to the demand. (ex. deciding which movie to see tonight, and active users will have higher weights)

Additional context

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions