ouyooung · GitHub

@ouyooung

harshil21

Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
…d other improvements.

Poolitzer

@harshil21

Pull request overview

This PR updates the library to match Telegram Bot API 9.6 poll-related changes by extending poll models, adding new poll service-message types, and wiring new poll parameters through bot shortcut methods and filters.

Changes:

  • Add new poll-related fields (description, allows_revoting, correct_option_ids, persistent IDs, etc.) and deprecate correct_option_id in favor of correct_option_ids.
  • Introduce PollOptionAdded/PollOptionDeleted service-message objects and add corresponding message types & filters.
  • Update tests and constants to cover the new/changed poll functionality.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/test_reply.py Extends ReplyParameters tests to cover poll_option_id.
tests/test_poll.py Adds coverage for new poll/poll option fields and new poll service-message objects.
tests/test_message.py Extends message fixture/test matrix to include new poll service-message fields.
tests/test_constants.py Updates constant/type-attribute expectations for new message fields.
tests/test_bot.py Adds test ensuring deprecated correct_option_id is mapped to correct_option_ids with a warning.
tests/ext/test_filters.py Adds tests for new filters.StatusUpdate poll-option service messages.
src/telegram/ext/filters.py Adds StatusUpdate.POLL_OPTION_ADDED/DELETED filters and includes them in StatusUpdate.ALL.
src/telegram/ext/_extbot.py Wires new Bot API 9.6 poll parameters through ExtBot.send_poll.
src/telegram/constants.py Adds new MessageType entries and updates poll limits (open period, description length).
src/telegram/_utils/types.py Introduces CorrectOptionIds typing alias for multi-answer quizzes.
src/telegram/_user.py Wires new poll parameters through User.send_poll shortcut.
src/telegram/_reply.py Documents and implements ReplyParameters.poll_option_id; updates entity allow-list wording.
src/telegram/_poll.py Extends PollOption, PollAnswer, Poll; adds PollOptionAdded/Deleted; adds parsing helpers and deprecations.
src/telegram/_message.py Adds new message fields for poll option add/delete service messages and reply-to poll option IDs; wires reply_poll params.
src/telegram/_inputchecklist.py Updates documentation wording re: allowed entities (includes date_time).
src/telegram/_chat.py Wires new poll parameters through Chat.send_poll shortcut.
src/telegram/_bot.py Adds new send_poll parameters and deprecation shim for correct_option_id.
src/telegram/init.py Exposes PollOptionAdded/PollOptionDeleted in the public API.
changes/unreleased/5196.7keq7yJhXbMb9RyShLHz4D.toml Adds PR metadata entry for this change set.

@harshil21

Poolitzer

@@ -93,6 +93,11 @@

CorrectOptionID: TypeAlias = Literal[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] # pylint: disable=invalid-name

@harshil21

Read the original on github.com ↗