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

Class InputPollOption

src/telegram/_poll.py:176–259  ·  view source on GitHub ↗

This object contains information about one answer option in a poll to be sent. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`text` is equal. .. versionadded:: 21.2 Args: text (:obj:`str`): Op

Source from the content-addressed store, hash-verified

174
175
176class InputPollOption(TelegramObject):
177 """
178 This object contains information about one answer option in a poll to be sent.
179
180 Objects of this class are comparable in terms of equality. Two objects of this class are
181 considered equal, if their :attr:`text` is equal.
182
183 .. versionadded:: 21.2
184
185 Args:
186 text (:obj:`str`): Option text,
187 :tg-const:`telegram.PollOption.MIN_LENGTH`-:tg-const:`telegram.PollOption.MAX_LENGTH`
188 characters.
189 text_parse_mode (:obj:`str`, optional): |parse_mode|
190 Currently, only custom emoji entities are allowed.
191 text_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special entities
192 that appear in the option :paramref:`text`. It can be specified instead of
193 :paramref:`text_parse_mode`.
194 Currently, only custom emoji entities are allowed.
195 This list is empty if the text does not contain entities.
196 media (:class:`telegram.InputPollOptionMedia`, optional): Media added to the poll option.
197
198 .. versionadded:: 22.8
199
200 Attributes:
201 text (:obj:`str`): Option text,
202 :tg-const:`telegram.PollOption.MIN_LENGTH`-:tg-const:`telegram.PollOption.MAX_LENGTH`
203 characters.
204 text_parse_mode (:obj:`str`): Optional. |parse_mode|
205 Currently, only custom emoji entities are allowed.
206 text_entities (Sequence[:class:`telegram.MessageEntity`]): Special entities
207 that appear in the option :paramref:`text`. It can be specified instead of
208 :paramref:`text_parse_mode`.
209 Currently, only custom emoji entities are allowed.
210 This list is empty if the text does not contain entities.
211 media (:class:`telegram.InputPollOptionMedia`): Optional. Media added to the poll option.
212
213 .. versionadded:: 22.8
214 """
215
216 __slots__ = ("media", "text", "text_entities", "text_parse_mode")
217
218 def __init__(
219 self,
220 text: str,
221 text_parse_mode: ODVInput[str] = DEFAULT_NONE,
222 text_entities: Sequence[MessageEntity] | None = None,
223 media: "InputPollOptionMedia | None" = None,
224 *,
225 api_kwargs: JSONDict | None = None,
226 ):
227 super().__init__(api_kwargs=api_kwargs)
228 self.text: str = text
229 self.text_parse_mode: ODVInput[str] = text_parse_mode
230 self.text_entities: tuple[MessageEntity, ...] = parse_sequence_arg(text_entities)
231 self.media: InputPollOptionMedia | None = media
232
233 self._id_attrs = (self.text,)

Callers 7

send_pollMethod · 0.90
input_poll_optionFunction · 0.90
test_to_dictMethod · 0.90
test_equalityMethod · 0.90

Calls

no outgoing calls

Tested by 6

input_poll_optionFunction · 0.72
test_to_dictMethod · 0.72
test_equalityMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…