MCPcopy Index your code
hub / github.com/python-telegram-bot/python-telegram-bot / PollOption

Class PollOption

src/telegram/_poll.py:262–449  ·  view source on GitHub ↗

This object contains information about one answer option in a poll. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`text`, :attr:`voter_count` and :attr:`persistent_id` are equal. .. versionchanged:: 22

Source from the content-addressed store, hash-verified

260
261
262class PollOption(TelegramObject):
263 """
264 This object contains information about one answer option in a poll.
265
266 Objects of this class are comparable in terms of equality. Two objects of this class are
267 considered equal, if their :attr:`text`, :attr:`voter_count` and :attr:`persistent_id`
268 are equal.
269
270 .. versionchanged:: 22.8
271 Added attribute :attr:`persistent_id` to equality checks.
272
273
274 Args:
275 persistent_id (:obj:`str`): Unique identifier of the option, persistent on option addition
276 and deletion.
277
278 .. versionadded:: 22.8
279 text (:obj:`str`): Option text,
280 :tg-const:`telegram.PollOption.MIN_LENGTH`-:tg-const:`telegram.PollOption.MAX_LENGTH`
281 characters.
282 voter_count (:obj:`int`): Number of users that voted for this option.
283 text_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special entities
284 that appear in the option text. Currently, only custom emoji entities are allowed in
285 poll option texts.
286
287 .. versionadded:: 21.2
288 media (:class:`telegram.PollMedia`, optional): Media added to the poll option.
289
290 .. versionadded:: 22.8
291 added_by_user (:class:`telegram.User`, optional): User who added the option;
292 omitted if the option wasn't added by a user after poll creation.
293
294 .. versionadded:: 22.8
295 added_by_chat (:class:`telegram.Chat`, optional): Chat that added the option;
296 omitted if the option wasn't added by a chat after poll creation.
297
298 .. versionadded:: 22.8
299 addition_date (:obj:`datetime.datetime`, optional): Point in time
300 when the option was added; omitted if the option existed in the original poll.
301
302 .. versionadded:: 22.8
303
304 Attributes:
305 persistent_id (:obj:`str`): Unique identifier of the option, persistent on option addition
306 and deletion.
307
308 .. versionadded:: 22.8
309 text (:obj:`str`): Option text,
310 :tg-const:`telegram.PollOption.MIN_LENGTH`-:tg-const:`telegram.PollOption.MAX_LENGTH`
311 characters.
312 voter_count (:obj:`int`): Number of users that voted for this option.
313 text_entities (tuple[:class:`telegram.MessageEntity`]): Special entities
314 that appear in the option text. Currently, only custom emoji entities are allowed in
315 poll option texts.
316 This list is empty if the question does not contain entities.
317
318 .. versionadded:: 21.2
319 media (:class:`telegram.PollMedia`): Optional. Media added to the poll option.

Callers 15

test_update.pyFile · 0.90
test_equalityMethod · 0.90
poll_optionFunction · 0.90
test_equalityMethod · 0.90
test_equalityMethod · 0.90
PollTestBaseClass · 0.90
test_equalityMethod · 0.90

Calls

no outgoing calls

Tested by 13

test_equalityMethod · 0.72
poll_optionFunction · 0.72
test_equalityMethod · 0.72
test_equalityMethod · 0.72
test_equalityMethod · 0.72
postMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…