o
    ZzjÅà  ã                   @   sÜ  d Z ddlZddlmZ ddlmZmZ ddlm	Z	 ddl
mZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z! ddl"m#Z# ddl$m%Z% ddl&m'Z'm(Z(m)Z)m*Z* ddl+m,Z,m-Z-m.Z. ddl/m0Z0 ddl1m2Z2m3Z3 ddl4m5Z5m6Z6m7Z7 ddl8m9Z9 ddl:m;Z; er´ddlm<Z<m=Z=m>Z> G dd„ de!ƒZ?G dd„ de!ƒZ@G d d!„ d!e!ƒZAG d"d#„ d#e!ƒZBG d$d%„ d%e!ƒZCG d&d'„ d'e!ƒZDG d(d)„ d)e!ƒZEdS )*z?This module contains an object that represents a Telegram Poll.é    N)ÚSequence)ÚTYPE_CHECKINGÚFinal)Ú	constants)ÚChat)Ú	Animation)ÚAudio)ÚDocument)Ú	LivePhoto)ÚLocation)Ú	PhotoSize)ÚSticker)ÚVenue)ÚVideo)ÚMessageEntity)ÚTelegramObject)ÚUser)Úenum)Úde_json_optionalÚde_list_optionalÚparse_sequence_argÚto_timedelta)Úextract_tzinfo_from_defaultsÚfrom_timestampÚget_timedelta_value)ÚDEFAULT_NONE)Úparse_message_entitiesÚparse_message_entity)ÚJSONDictÚODVInputÚ
TimePeriod)Úwarn)ÚPTBDeprecationWarning)ÚBotÚInputPollOptionMediaÚMaybeInaccessibleMessagec                       s´   e Zd ZdZdZ									dddœdedB dedB dedB dedB d	e	dB d
e
e dB dedB dedB dedB dedB f‡ fdd„Zeddedddd f‡ fdd„ƒZ‡  ZS )Ú	PollMediaaW
  
    At most one of the optional fields can be present in any given object.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if all of their attributes are equal.

    .. versionadded:: 22.8

    Args:
        animation (:class:`telegram.Animation`, optional): Media is an animation, information about
            the animation
        audio (:class:`telegram.Audio`, optional): Media is an audio file, information about the
            file; currently, can't be received in a poll option
        document (:class:`telegram.Document`, optional): Media is a general file, information about
            the file; currently, can't be received in a poll option
        live_photo (:class:`telegram.LivePhoto`, optional): Media is a live photo, information
            about the live photo
        location (:class:`telegram.Location`, optional): Media is a shared location, information
            about the location
        photo (Sequence[:class:`telegram.PhotoSize`], optional): Media is a photo, available sizes
            of the photo
        sticker (:class:`telegram.Sticker`, optional): Media is a sticker, information about the
            sticker; currently, for poll options only
        venue (:class:`telegram.Venue`, optional): Media is a venue, information about the venue
        video (:class:`telegram.Video`, optional): Media is a video, information about the video

    Attributes:
        animation (:class:`telegram.Animation`): Optional. Media is an animation, information about
            the animation
        audio (:class:`telegram.Audio`): Optional. Media is an audio file, information about the
            file; currently, can't be received in a poll option
        document (:class:`telegram.Document`): Optional. Media is a general file, information about
            the file; currently, can't be received in a poll option
        live_photo (:class:`telegram.LivePhoto`, optional): Media is a live photo, information
            about the live photo
        location (:class:`telegram.Location`): Optional. Media is a shared location, information
            about the location
        photo (tuple[:class:`telegram.PhotoSize`]): Optional. Media is a photo, available sizes
            of the photo
        sticker (:class:`telegram.Sticker`): Optional. Media is a sticker, information about the
            sticker; currently, for poll options only
        venue (:class:`telegram.Venue`): Optional. Media is a venue, information about the venue
        video (:class:`telegram.Video`): Optional. Media is a video, information about the video
    )	Ú	animationÚaudioÚdocumentÚ
live_photoÚlocationÚphotoÚstickerÚvenueÚvideoN©Ú
api_kwargsr'   r(   r)   r*   r+   r,   r-   r.   r/   r1   c
             	      s~   t ƒ j|
d� || _|| _|| _|| _|| _t|ƒ| _|| _	|| _
|	| _| j| j| j| j| j| j| j	| j
| jf	| _|  ¡  d S ©Nr0   )ÚsuperÚ__init__r'   r(   r)   r*   r+   r   r,   r-   r.   r/   Ú	_id_attrsÚ_freeze)Úselfr'   r(   r)   r*   r+   r,   r-   r.   r/   r1   ©Ú	__class__© úI/var/www/kodo/tsheker/venv/lib/python3.10/site-packages/telegram/_poll.pyr4   w   s*   
÷zPollMedia.__init__ÚdataÚbotú
Bot | NoneÚreturnc                    sà   |   |¡}t| d¡t|ƒ|d< t| d¡t|ƒ|d< t| d¡t|ƒ|d< t| d¡t|ƒ|d< t| d¡t|ƒ|d< t| d¡t	|ƒ|d< t| d¡t
|ƒ|d< t| d¡t|ƒ|d< t| d	¡t|ƒ|d	< tƒ j||d
�S )ú,See :meth:`telegram.TelegramObject.de_json`.r'   r(   r)   r*   r+   r,   r-   r.   r/   ©r<   r=   )Ú_parse_datar   Úgetr   r   r	   r
   r   r   r   r   r   r   r3   Úde_json©Úclsr<   r=   r8   r:   r;   rD   ž   s   
zPollMedia.de_json)	NNNNNNNNN©N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   r	   r
   r   r   r   r   r   r   r   r4   ÚclassmethodrD   Ú__classcell__r:   r:   r8   r;   r&   =   sJ    -öôþýüûú
ùø	÷
öô'&r&   c                       sx   e Zd ZdZdZeddfddœdedee dee	 dB dd	d
e
dB f
‡ fdd„Zedde
dddd f‡ fdd„ƒZ‡  ZS )ÚInputPollOptiona(  
    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`): Option text,
            :tg-const:`telegram.PollOption.MIN_LENGTH`-:tg-const:`telegram.PollOption.MAX_LENGTH`
            characters.
        text_parse_mode (:obj:`str`, optional): |parse_mode|
            Currently, only custom emoji entities are allowed.
        text_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special entities
            that appear in the option :paramref:`text`. It can be specified instead of
            :paramref:`text_parse_mode`.
            Currently, only custom emoji entities are allowed.
            This list is empty if the text does not contain entities.
        media (:class:`telegram.InputPollOptionMedia`, optional): Media added to the poll option.

            .. versionadded:: 22.8

    Attributes:
        text (:obj:`str`): Option text,
            :tg-const:`telegram.PollOption.MIN_LENGTH`-:tg-const:`telegram.PollOption.MAX_LENGTH`
            characters.
        text_parse_mode (:obj:`str`): Optional. |parse_mode|
            Currently, only custom emoji entities are allowed.
        text_entities (Sequence[:class:`telegram.MessageEntity`]): Special entities
            that appear in the option :paramref:`text`. It can be specified instead of
            :paramref:`text_parse_mode`.
            Currently, only custom emoji entities are allowed.
            This list is empty if the text does not contain entities.
        media (:class:`telegram.InputPollOptionMedia`): Optional. Media added to the poll option.

            .. versionadded:: 22.8
    )ÚmediaÚtextÚtext_entitiesÚtext_parse_modeNr0   rQ   rS   rR   rP   zInputPollOptionMedia | Noner1   c                   s@   t ƒ j|d� || _|| _t|ƒ| _|| _| jf| _|  ¡  d S r2   )	r3   r4   rQ   rS   r   rR   rP   r5   r6   )r7   rQ   rS   rR   rP   r1   r8   r:   r;   r4   Ú   s   	

zInputPollOption.__init__r<   r=   r>   r?   c                    sB   t tddƒdd� |  |¡}t| d¡t|ƒ|d< tƒ j||d�S )zïSee :meth:`telegram.TelegramObject.de_json`. The :paramref:`media` field will
        not be included for deserialization.

        .. deprecated:: 22.8
            This class is input only and will be removed in the next version.
        ú22.8z¦`InputPollOption.de_json` is deprecated. This class is input only and will be removed in the next version. The `media` field will not be included for deserialization.é   ©Ú
stacklevelrR   rA   )r!   r"   rB   r   rC   r   r3   rD   rE   r8   r:   r;   rD   î   s   þù
	zInputPollOption.de_jsonrG   )rH   rI   rJ   rK   rL   r   Ústrr   r   r   r   r4   rM   rD   rN   r:   r:   r8   r;   rO   °   s*    'ûùþý
üûù&rO   c                       s  e Zd ZU dZdZ						dddœdededee dB de	dB d	e
dB d
ejdB dedB dedB dedB f‡ fdd„Zeddedddd f‡ fdd„ƒZdedefdd„Zddee dB deeef fdd„ZejjZee ed< 	 ejjZee ed< ‡  ZS ) Ú
PollOptiona›  
    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.8
        Added attribute :attr:`persistent_id` to equality checks.


    Args:
        persistent_id (:obj:`str`): Unique identifier of the option, persistent on option addition
            and deletion.

            .. versionadded:: 22.8
        text (:obj:`str`): Option text,
            :tg-const:`telegram.PollOption.MIN_LENGTH`-:tg-const:`telegram.PollOption.MAX_LENGTH`
            characters.
        voter_count (:obj:`int`): Number of users that voted for this option.
        text_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special entities
            that appear in the option text. Currently, only custom emoji entities are allowed in
            poll option texts.

            .. versionadded:: 21.2
        media (:class:`telegram.PollMedia`, optional): Media added to the poll option.

            .. versionadded:: 22.8
        added_by_user (:class:`telegram.User`, optional): User who added the option;
            omitted if the option wasn't added by a user after poll creation.

            .. versionadded:: 22.8
        added_by_chat (:class:`telegram.Chat`, optional): Chat that added the option;
            omitted if the option wasn't added by a chat after poll creation.

            .. versionadded:: 22.8
        addition_date (:obj:`datetime.datetime`, optional): Point in time
            when the option was added; omitted if the option existed in the original poll.

            .. versionadded:: 22.8

    Attributes:
        persistent_id (:obj:`str`): Unique identifier of the option, persistent on option addition
            and deletion.

            .. versionadded:: 22.8
        text (:obj:`str`): Option text,
            :tg-const:`telegram.PollOption.MIN_LENGTH`-:tg-const:`telegram.PollOption.MAX_LENGTH`
            characters.
        voter_count (:obj:`int`): Number of users that voted for this option.
        text_entities (tuple[:class:`telegram.MessageEntity`]): Special entities
            that appear in the option text. Currently, only custom emoji entities are allowed in
            poll option texts.
            This list is empty if the question does not contain entities.

            .. versionadded:: 21.2
        media (:class:`telegram.PollMedia`): Optional. Media added to the poll option.

            .. versionadded:: 22.8
        added_by_user (:class:`telegram.User`): Optional. User who added the option;
            omitted if the option wasn't added by a user after poll creation.

            .. versionadded:: 22.8
        added_by_chat (:class:`telegram.Chat`): Optional. Chat that added the option;
            omitted if the option wasn't added by a chat after poll creation.

            .. versionadded:: 22.8
        addition_date (:obj:`datetime.datetime`): Optional. Point in time
            when the option was added; omitted if the option existed in the original poll.

            .. versionadded:: 22.8
    )Úadded_by_chatÚadded_by_userÚaddition_daterP   Úpersistent_idrQ   rR   Úvoter_countNr0   rQ   r^   rR   r[   rZ   r\   rP   r]   r1   c	          
         sp   |d u rt dƒ‚tƒ j|	d� || _|| _|| _|| _|| _|| _|| _	t
|ƒ| _| j| j| jf| _|  ¡  d S )Nz8`persistent_id` is a required argument since Bot API 9.6r0   )Ú	TypeErrorr3   r4   rQ   r^   r[   rZ   r\   r]   rP   r   rR   r5   r6   )
r7   rQ   r^   rR   r[   rZ   r\   rP   r]   r1   r8   r:   r;   r4   [  s   
zPollOption.__init__r<   r=   r>   r?   c                    s�   |   |¡}t|ƒ}t| d¡t|ƒ|d< t| d¡t|ƒ|d< t| d¡t|ƒ|d< t| d¡|d�|d< t| d¡t	|ƒ|d< t
ƒ j||d�S )r@   rR   r[   rZ   r\   ©ÚtzinforP   rA   )rB   r   r   rC   r   r   r   r   r   r&   r3   rD   ©rF   r<   r=   Ú
loc_tzinfor8   r:   r;   rD   |  s   
zPollOption.de_jsonÚentityc                 C   ó   t | j|ƒS )a´  Returns the text in :attr:`text`
        from a given :class:`telegram.MessageEntity` of :attr:`text_entities`.

        Note:
            This method is present because Telegram calculates the offset and length in
            UTF-16 codepoint pairs, which some versions of Python don't handle automatically.
            (That is, you can't just slice ``Message.text`` with the offset and length.)

        .. versionadded:: 21.2

        Args:
            entity (:class:`telegram.MessageEntity`): The entity to extract the text from. It must
                be an entity that belongs to :attr:`text_entities`.

        Returns:
            :obj:`str`: The text of the given entity.
        )r   rQ   ©r7   rd   r:   r:   r;   Úparse_entityŒ  ó   zPollOption.parse_entityÚtypesc                 C   ó   t | j| j|ƒS )a(  
        Returns a :obj:`dict` that maps :class:`telegram.MessageEntity` to :obj:`str`.
        It contains entities from this polls question filtered by their ``type`` attribute as
        the key, and the text that each entity belongs to as the value of the :obj:`dict`.

        Note:
            This method should always be used instead of the :attr:`text_entities`
            attribute, since it calculates the correct substring from the message text based on
            UTF-16 codepoints. See :attr:`parse_entity` for more info.

        .. versionadded:: 21.2

        Args:
            types (list[:obj:`str`], optional): List of ``MessageEntity`` types as strings. If the
                    ``type`` attribute of an entity is contained in this list, it will be returned.
                    Defaults to :attr:`telegram.MessageEntity.ALL_TYPES`.

        Returns:
            dict[:class:`telegram.MessageEntity`, :obj:`str`]: A dictionary of entities mapped to
            the text that belongs to them, calculated based on UTF-16 codepoints.
        )r   rQ   rR   ©r7   ri   r:   r:   r;   Úparse_entities   ó   zPollOption.parse_entitiesÚ
MIN_LENGTHÚ
MAX_LENGTH)NNNNNNrG   )rH   rI   rJ   rK   rL   rX   Úintr   r   r   r   ÚdtmÚdatetimer&   r   r4   rM   rD   rg   ÚlistÚdictrl   r   Ú	PollLimitÚMIN_OPTION_LENGTHrn   r   Ú__annotations__ÚMAX_OPTION_LENGTHro   rN   r:   r:   r8   r;   rY     sL   
 Iõóþý
üûúùøõó!$rY   c                       s„   e Zd ZdZdZ			dddœdedee dedB de	dB d	ee dB d
e
dB f‡ fdd„Zedde
dddd f‡ fdd„ƒZ‡  ZS )Ú
PollAnsweraT
  
    This object represents an answer of a user in a non-anonymous poll.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`poll_id`, :attr:`user` and :attr:`option_ids` are equal.

    .. versionchanged:: 20.5
        The order of :paramref:`option_ids` and :paramref:`user` is changed in
        20.5 as the latter one became optional.

    .. versionchanged:: 20.6
       Backward compatiblity for changed order of :paramref:`option_ids` and :paramref:`user`
       was removed.

    Args:
        poll_id (:obj:`str`): Unique poll identifier.
        option_ids (Sequence[:obj:`int`]): Identifiers of answer options, chosen by the user. May
            be empty if the user retracted their vote.

            .. versionchanged:: 20.0
                |sequenceclassargs|
        option_persistent_ids (Sequence[:obj:`str`]): Persistent identifiers of the
            chosen answer options. May be empty if the vote was retracted.

            .. versionadded:: 22.8
        user (:class:`telegram.User`, optional): The user that changed the answer to the poll,
            if the voter isn't anonymous. If the voter is anonymous, this field will contain the
            user :tg-const:`telegram.constants.ChatID.FAKE_CHANNEL` for backwards compatibility.

            .. versionchanged:: 20.5
                :paramref:`user` became optional.
        voter_chat (:class:`telegram.Chat`, optional): The chat that changed the answer to the
            poll, if the voter is anonymous.

            .. versionadded:: 20.5

    Attributes:
        poll_id (:obj:`str`): Unique poll identifier.
        option_ids (tuple[:obj:`int`]): Identifiers of answer options, chosen by the user. May
            be empty if the user retracted their vote.

            .. versionchanged:: 20.0
                |tupleclassattrs|
        option_persistent_ids (tuple[:obj:`str`]): Persistent identifiers of the
            chosen answer options. May be empty if the vote was retracted.

            .. versionadded:: 22.8
        user (:class:`telegram.User`): Optional. The user, who changed the answer to the
            poll, if the voter isn't anonymous. If the voter is anonymous, this field will contain
            the user :tg-const:`telegram.constants.ChatID.FAKE_CHANNEL` for backwards compatibility

            .. versionchanged:: 20.5
                :paramref:`user` became optional.
        voter_chat (:class:`telegram.Chat`): Optional. The chat that changed the answer to the
            poll, if the voter is anonymous.

            .. versionadded:: 20.5
    )Ú
option_idsÚoption_persistent_idsÚpoll_idÚuserÚ
voter_chatNr0   r|   rz   r}   r~   r{   r1   c                   sf   |d u rt dƒ‚tƒ j|d� || _|| _t|ƒ| _|| _t|ƒ| _| j| j| j| jf| _	|  
¡  d S )Nz@`option_persistent_ids` is a required argument since Bot API 9.6r0   )r_   r3   r4   r|   r~   r   rz   r}   r{   r5   r6   )r7   r|   rz   r}   r~   r{   r1   r8   r:   r;   r4     s   

üzPollAnswer.__init__r<   r=   r>   r?   c                    sF   |   |¡}t| d¡t|ƒ|d< t| d¡t|ƒ|d< tƒ j||d�S )r@   r}   r~   rA   )rB   r   rC   r   r   r3   rD   rE   r8   r:   r;   rD   !  s   
zPollAnswer.de_json)NNNrG   )rH   rI   rJ   rK   rL   rX   r   rp   r   r   r   r4   rM   rD   rN   r:   r:   r8   r;   ry   Ä  s.    ;ø
öþýüû
ø
ö&ry   c                       óª   e Zd ZdZdZ		dddœdededdd	ee dB d
edB f
‡ fdd„Z	e
ddedddd f‡ fdd„ƒZdedefdd„Z	ddee dB deeef fdd„Z‡  ZS )ÚPollOptionAddedaÿ  
    Describes a service message about an option added to a poll.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`option_persistent_id`, and :attr:`option_text` are equal.

    .. versionadded:: 22.8

    Args:
        option_persistent_id (:obj:`str`): Unique identifier of the added option.
        option_text (:obj:`str`): Option text.
        poll_message (:class:`telegram.MaybeInaccessibleMessage`, optional): Message
            containing the poll to which the option was added, if known.
            Note that the Message object in this field will not contain the
            :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply.
        option_text_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special
            entities that appear in the :paramref:`option_text`.

    Attributes:
        option_persistent_id (:obj:`str`): Unique identifier of the added option.
        option_text (:obj:`str`): Option text.
        poll_message (:class:`telegram.MaybeInaccessibleMessage`): Optional. Message
            containing the poll to which the option was added, if known.
            Note that the Message object in this field will not contain the
            :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply.
        option_text_entities (tuple[:class:`telegram.MessageEntity`]): Optional. Special
            entities that appear in the :paramref:`option_text`.
    ©Úoption_persistent_idÚoption_textÚoption_text_entitiesÚpoll_messageNr0   r‚   rƒ   r…   úMaybeInaccessibleMessage | Noner„   r1   c                   óD   t ƒ j|d� || _|| _|| _t|ƒ| _| j| jf| _|  ¡  d S r2   ©	r3   r4   r‚   rƒ   r…   r   r„   r5   r6   ©r7   r‚   rƒ   r…   r„   r1   r8   r:   r;   r4   L  ó   	ÿzPollOptionAdded.__init__r<   r=   r>   r?   c                    óR   ddl m} |  |¡}t| d¡||ƒ|d< t| d¡t|ƒ|d< tƒ j||d�S ©r@   r   )r%   r…   r„   rA   ©	Útelegram._messager%   rB   r   rC   r   r   r3   rD   ©rF   r<   r=   r%   r8   r:   r;   rD   b  ó   
ÿÿzPollOptionAdded.de_jsonrd   c                 C   re   ©a©  Returns the text in :attr:`option_text`
        from a given :class:`telegram.MessageEntity` of :attr:`option_text_entities`.

        Note:
            This method is present because Telegram calculates the offset and length in
            UTF-16 codepoint pairs, which some versions of Python don't handle automatically.
            (That is, you can't just slice ``Message.text`` with the offset and length.)

        Args:
            entity (:class:`telegram.MessageEntity`): The entity to extract the text from. It must
                be an entity that belongs to :attr:`option_text_entities`.

        Returns:
            :obj:`str`: The text of the given entity.
        ©r   rƒ   rf   r:   r:   r;   Úparse_option_text_entityt  ó   z(PollOptionAdded.parse_option_text_entityri   c                 C   rj   ©a  
        Returns a :obj:`dict` that maps :class:`telegram.MessageEntity` to :obj:`str`.
        It contains entities from this polls option text filtered by their ``type`` attribute as
        the key, and the text that each entity belongs to as the value of the :obj:`dict`.

        Note:
            This method should always be used instead of the :attr:`option_text_entities`
            attribute, since it calculates the correct substring from the message text based on
            UTF-16 codepoints. See :attr:`parse_entity` for more info.

        Args:
            types (list[:obj:`str`], optional): List of ``MessageEntity`` types as strings. If the
                    ``type`` attribute of an entity is contained in this list, it will be returned.
                    Defaults to :attr:`telegram.MessageEntity.ALL_TYPES`.

        Returns:
            dict[:class:`telegram.MessageEntity`, :obj:`str`]: A dictionary of entities mapped to
            the text that belongs to them, calculated based on UTF-16 codepoints.
        ©r   rƒ   r„   rk   r:   r:   r;   Úparse_option_text_entities†  rm   z*PollOptionAdded.parse_option_text_entities©NNrG   ©rH   rI   rJ   rK   rL   rX   r   r   r   r4   rM   rD   r“   rs   rt   r—   rN   r:   r:   r8   r;   r€   ,  ó6    ûùþýü
ûùÿ
ÿ
þr€   c                       r   )ÚPollOptionDeletedaï  
    Describes a service message about an option deleted from a poll.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`option_persistent_id`, :attr:`option_text` are equal.

    .. versionadded:: 22.8

    Args:
        option_persistent_id (:obj:`str`): Unique identifier of the deleted option.
        option_text (:obj:`str`): Option text.
        poll_message (:class:`telegram.MaybeInaccessibleMessage`, optional): Message
            containing the poll to which the option was deleted, if known.
            Note that the Message object in this field will not contain the
            :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply.
        option_text_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special
            entities that appear in the option_text.

    Attributes:
        option_persistent_id (:obj:`str`): Unique identifier of the deleted option.
        option_text (:obj:`str`): Option text.
        poll_message (:class:`telegram.MaybeInaccessibleMessage`): Optional. Message
            containing the poll to which the option was deleted, if known.
            Note that the Message object in this field will not contain the
            :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply.
        option_text_entities (tuple[:class:`telegram.MessageEntity`]): Optional. Special
            entities that appear in the option_text.
    r�   Nr0   r‚   rƒ   r…   r†   r„   r1   c                   r‡   r2   rˆ   r‰   r8   r:   r;   r4   ¿  rŠ   zPollOptionDeleted.__init__r<   r=   r>   r?   c                    r‹   rŒ   r�   r�   r8   r:   r;   rD   Õ  r�   zPollOptionDeleted.de_jsonrd   c                 C   re   r‘   r’   rf   r:   r:   r;   r“   ç  r”   z*PollOptionDeleted.parse_option_text_entityri   c                 C   rj   r•   r–   rk   r:   r:   r;   r—   ù  rm   z,PollOptionDeleted.parse_option_text_entitiesr˜   rG   r™   r:   r:   r8   r;   r›   Ÿ  rš   r›   c                1       s(  e Zd ZU dZdZ														dDddœdededee ded	e	d
e	dede	dedB dedB dee
 dB dedB dejdB dee
 dB de	dB de	dB dee dB dedB dee
 dB dee dB dedB dedB dedB f.‡ fdd„ZedeejB dB fdd „ƒZedEd!ed"d#dd f‡ fd$d%„ƒZd&e
defd'd(„Z	dEd)ee dB dee
ef fd*d+„Zd&e
defd,d-„ZdEd)ee dB dee
ef fd.d/„Zd&e
defd0d1„Z	dEd)ee dB dee
ef fd2d3„ZededB fd4d5„ƒZej j!Z!e"e e#d6< 	 ej j$Z$e"e e#d7< 	 ej%j&Z&e"e e#d8< 	 ej%j'Z'e"e e#d9< 	 ej%j(Z(e"e e#d:< 	 ej%j)Z)e"e e#d;< 	 ej%j*Z*e"e e#d<< 	 ej%j+Z+e"e e#d=< 	 ej%j,Z,e"e e#d>< 	 ej%j-Z-e"e e#d?< 	 ej%j.Z.e"e e#d@< 	 ej%j/Z/e"e e#dA< 	 ej%j0Z0e"e e#dB< 	 ej%j1Z1e"e e#dC< ‡  Z2S )FÚPolla#"  
    This object contains information about a poll.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`id` is equal.

    Examples:
        :any:`Poll Bot <examples.pollbot>`

    Args:
        id (:obj:`str`): Unique poll identifier.
        question (:obj:`str`): Poll question, :tg-const:`telegram.Poll.MIN_QUESTION_LENGTH`-
            :tg-const:`telegram.Poll.MAX_QUESTION_LENGTH` characters.
        options (Sequence[:class:`~telegram.PollOption`]): List of poll options.

            .. versionchanged:: 20.0
                |sequenceclassargs|
        is_closed (:obj:`bool`): :obj:`True`, if the poll is closed.
        is_anonymous (:obj:`bool`): :obj:`True`, if the poll is anonymous.
        type (:obj:`str`): Poll type, currently can be :attr:`REGULAR` or :attr:`QUIZ`.
        allows_multiple_answers (:obj:`bool`): :obj:`True`, if the poll allows multiple answers.
        members_only (:obj:`bool`): :obj:`True`, if voting is limited to users who have been
            members of the chat where the poll was originally sent for more than
            :tg-const:`telegram.Poll.MIN_MEMBERSHIP_HOURS` hours.

            .. versionadded:: 22.8
        correct_option_id (:obj:`int`, optional): A zero based identifier of the correct answer
            option. Available only for closed polls in the quiz mode, which were sent
            (not forwarded), by the bot or to a private chat with the bot.

            .. deprecated:: 22.8
                Use :paramref:`correct_option_ids` instead.
        explanation (:obj:`str`, optional): Text that is shown when a user chooses an incorrect
            answer or taps on the lamp icon in a quiz-style poll,
            0-:tg-const:`telegram.Poll.MAX_EXPLANATION_LENGTH` characters.
        explanation_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special
            entities like usernames, URLs, bot commands, etc. that appear in the
            :attr:`explanation`. This list is empty if the message does not contain explanation
            entities.

            .. versionchanged:: 20.0

               * This attribute is now always a (possibly empty) list and never :obj:`None`.
               * |sequenceclassargs|
        explanation_media (:class:`telegram.PollMedia`, optional): Media added to the quiz
            explanation.

            .. versionadded:: 22.8
        open_period (:obj:`int` | :class:`datetime.timedelta`, optional): Amount of time in seconds
            the poll will be active after creation.

            .. versionchanged:: v22.2
                |time-period-input|
        close_date (:obj:`datetime.datetime`, optional): Point in time (Unix timestamp) when the
            poll will be automatically closed. Converted to :obj:`datetime.datetime`.

            .. versionchanged:: 20.3
                |datetime_localization|
        question_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special entities
            that appear in the :attr:`question`. Currently, only custom emoji entities are allowed
            in poll questions.

            .. versionadded:: 21.2
        allows_revoting (:obj:`bool`, optional): :obj:`True`, if the poll allows to
            change the chosenanswer options.

            .. versionadded:: 22.8
        correct_option_ids (Sequence[:class:`int`], optional): Array of 0-based identifiers of
            the correct answer options. Available only for polls in quiz mode which are closed or
            were sent (not forwarded) by the bot or to the private chat with the bot.

            .. versionadded:: 22.8
        country_codes (Sequence[:obj:`str`], optional): A list of two-letter ``ISO 3166-1 alpha-2``
            country codes indicating the countries from which users can vote in the poll. The
            country code ``"FT"`` is used for users with anonymous numbers. If omitted, then users
            from any country can participate in the poll.

            .. versionadded:: 22.8
        description (:obj:`str`, optional): Description of the poll;
            for polls inside the :class:`~telegram.Message` object only.

            .. versionadded:: 22.8
        description_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special
            entities like usernames, URLs, bot commands, etc. that appear in the description

            .. versionadded:: 22.8
        media (:class:`telegram.PollMedia`, optional): Media added to the poll description;
            for polls inside the :class:`~telegram.Message` object only.

            .. versionadded:: 22.8

    Attributes:
        id (:obj:`str`): Unique poll identifier.
        question (:obj:`str`): Poll question, :tg-const:`telegram.Poll.MIN_QUESTION_LENGTH`-
            :tg-const:`telegram.Poll.MAX_QUESTION_LENGTH` characters.
        options (tuple[:class:`~telegram.PollOption`]): List of poll options.

            .. versionchanged:: 20.0
                |tupleclassattrs|
        total_voter_count (:obj:`int`): Total number of users that voted in the poll.
        is_closed (:obj:`bool`): :obj:`True`, if the poll is closed.
        is_anonymous (:obj:`bool`): :obj:`True`, if the poll is anonymous.
        type (:obj:`str`): Poll type, currently can be :attr:`REGULAR` or :attr:`QUIZ`.
        allows_multiple_answers (:obj:`bool`): :obj:`True`, if the poll allows multiple answers.
        members_only (:obj:`bool`): :obj:`True`, if voting is limited to users who have been
            members of the chat where the poll was originally sent for more than
            :tg-const:`telegram.Poll.MIN_MEMBERSHIP_HOURS` hours.

            .. versionadded:: 22.8
        explanation (:obj:`str`): Optional. Text that is shown when a user chooses an incorrect
            answer or taps on the lamp icon in a quiz-style poll,
            0-:tg-const:`telegram.Poll.MAX_EXPLANATION_LENGTH` characters.
        explanation_entities (tuple[:class:`telegram.MessageEntity`]): Special entities
            like usernames, URLs, bot commands, etc. that appear in the :attr:`explanation`.
            This list is empty if the message does not contain explanation entities.

            .. versionchanged:: 20.0
                |tupleclassattrs|

            .. versionchanged:: 20.0
               This attribute is now always a (possibly empty) list and never :obj:`None`.
        explanation_media (:class:`telegram.PollMedia`): Optional. Media added to the quiz
            explanation.

            .. versionadded:: 22.8
        open_period (:obj:`int` | :class:`datetime.timedelta`): Optional. Amount of time in seconds
            the poll will be active after creation.

            .. deprecated:: v22.2
                |time-period-int-deprecated|
        close_date (:obj:`datetime.datetime`): Optional. Point in time when the poll will be
            automatically closed.

            .. versionchanged:: 20.3
                |datetime_localization|
        question_entities (tuple[:class:`telegram.MessageEntity`]): Special entities
            that appear in the :attr:`question`. Currently, only custom emoji entities are allowed
            in poll questions.
            This list is empty if the question does not contain entities.

            .. versionadded:: 21.2
        allows_revoting (:obj:`bool`): :obj:`True`, if the poll
            allows to change the chosenanswer options

            .. versionadded:: 22.8
        correct_option_ids (tuple[:class:`int`]): Array of 0-based identifiers of the
            correct answer options. Available only for polls in quiz mode which are closed or were
            sent (not forwarded) by the bot or to the private chat with the bot.

            .. versionadded:: 22.8
        country_codes (tuple[:obj:`str`]): Optional. A list of two-letter ``ISO 3166-1 alpha-2``
            country codes indicating the countries from which users can vote in the poll. The
            country code ``"FT"`` is used for users with anonymous numbers. If omitted, then users
            from any country can participate in the poll.

            .. versionadded:: 22.8
        description (:obj:`str`): Optional. Description of the poll;
            for polls inside the Message object only

            .. versionadded:: 22.8
        description_entities (tuple[:class:`telegram.MessageEntity`]): Special
            entities like usernames, URLs, bot commands, etc. that appear in the description

            .. versionadded:: 22.8
        media (:class:`telegram.PollMedia`): Optional. Media added to the poll description;
            for polls inside the Message object only.

            .. versionadded:: 22.8

    )Ú_open_periodÚallows_multiple_answersÚallows_revotingÚ
close_dateÚcorrect_option_idsÚcountry_codesÚdescriptionÚdescription_entitiesÚexplanationÚexplanation_entitiesÚexplanation_mediaÚidÚis_anonymousÚ	is_closedrP   Úmembers_onlyÚoptionsÚquestionÚquestion_entitiesÚtotal_voter_countÚtypeNr0   r¨   r­   r¬   r¯   rª   r©   r°   rž   Úcorrect_option_idr¥   r¦   Úopen_periodr    r®   rŸ   r«   r¡   r£   r¤   r¢   rP   r§   r1   c                   s  |d u rt dƒ‚|d u rt dƒ‚tƒ j|d� || _|| _t|ƒ| _|| _|| _|| _	t
 tj||¡| _|| _|| _|| _|	d urQttddƒdd� |d u rQ|	g}t|ƒ| _|| _t|ƒ| _|
| _t|ƒ| _t|ƒ| _|| _t|ƒ| _t|ƒ| _|| _|| _| jf| _ |  !¡  d S )Nz:`allows_revoting` is a required argument since Bot API 9.6z8`members_only` is a required argument since Bot API 10.0r0   rT   zRThe parameter `correct_option_id` is deprecated. Use `correct_option_ids` instead.rU   rV   )"r_   r3   r4   r¨   r­   r   r¬   r¯   rª   r©   r   Ú
get_memberr   ÚPollTyper°   rž   rŸ   r«   r!   r"   r¡   r£   r¤   r¥   r¦   r   r�   r    r®   r¢   rP   r§   r5   r6   )r7   r¨   r­   r¬   r¯   rª   r©   r°   rž   r±   r¥   r¦   r²   r    r®   rŸ   r«   r¡   r£   r¤   r¢   rP   r§   r1   r8   r:   r;   r4   Ö  sT   !
þú
ÿÿ



zPoll.__init__r?   c                 C   s   t | jdd�S )Nr²   )Ú	attribute)r   r�   ©r7   r:   r:   r;   r²   *  s   zPoll.open_periodr<   r=   r>   c                    s¼   |   |¡}t|ƒ}t| d¡t|ƒ|d< t| d¡t|ƒ|d< t| d¡|d�|d< t| d¡t|ƒ|d< t| d¡t|ƒ|d< t| d¡t|ƒ|d< t| d¡t|ƒ|d< t	ƒ j
||d	�S )
r@   r¬   r¦   r    r`   r®   r¤   rP   r§   rA   )rB   r   r   rC   rY   r   r   r   r&   r3   rD   rb   r8   r:   r;   rD   .  s    
ÿÿÿzPoll.de_jsonrd   c                 C   ó   | j stdƒ‚t| j |ƒS )aõ  Returns the text in :attr:`explanation` from a given :class:`telegram.MessageEntity` of
        :attr:`explanation_entities`.

        Note:
            This method is present because Telegram calculates the offset and length in
            UTF-16 codepoint pairs, which some versions of Python don't handle automatically.
            (That is, you can't just slice ``Message.text`` with the offset and length.)

        Args:
            entity (:class:`telegram.MessageEntity`): The entity to extract the text from. It must
                be an entity that belongs to :attr:`explanation_entities`.

        Returns:
            :obj:`str`: The text of the given entity.

        Raises:
            RuntimeError: If the poll has no explanation.

        úThis Poll has no 'explanation'.)r¥   ÚRuntimeErrorr   rf   r:   r:   r;   Úparse_explanation_entityF  s   zPoll.parse_explanation_entityri   c                 C   ó   | j stdƒ‚t| j | j|ƒS )aj  
        Returns a :obj:`dict` that maps :class:`telegram.MessageEntity` to :obj:`str`.
        It contains entities from this polls explanation filtered by their ``type`` attribute as
        the key, and the text that each entity belongs to as the value of the :obj:`dict`.

        Note:
            This method should always be used instead of the :attr:`explanation_entities`
            attribute, since it calculates the correct substring from the message text based on
            UTF-16 codepoints. See :attr:`parse_explanation_entity` for more info.

        Args:
            types (list[:obj:`str`], optional): List of ``MessageEntity`` types as strings. If the
                    ``type`` attribute of an entity is contained in this list, it will be returned.
                    Defaults to :attr:`telegram.MessageEntity.ALL_TYPES`.

        Returns:
            dict[:class:`telegram.MessageEntity`, :obj:`str`]: A dictionary of entities mapped to
            the text that belongs to them, calculated based on UTF-16 codepoints.

        Raises:
            RuntimeError: If the poll has no explanation.

        r¸   )r¥   r¹   r   r¦   rk   r:   r:   r;   Úparse_explanation_entities_  s   zPoll.parse_explanation_entitiesc                 C   re   )aÀ  Returns the text in :attr:`question` from a given :class:`telegram.MessageEntity` of
        :attr:`question_entities`.

        .. versionadded:: 21.2

        Note:
            This method is present because Telegram calculates the offset and length in
            UTF-16 codepoint pairs, which some versions of Python don't handle automatically.
            (That is, you can't just slice ``Message.text`` with the offset and length.)

        Args:
            entity (:class:`telegram.MessageEntity`): The entity to extract the text from. It must
                be an entity that belongs to :attr:`question_entities`.

        Returns:
            :obj:`str`: The text of the given entity.
        )r   r­   rf   r:   r:   r;   Úparse_question_entity~  rh   zPoll.parse_question_entityc                 C   rj   )a6  
        Returns a :obj:`dict` that maps :class:`telegram.MessageEntity` to :obj:`str`.
        It contains entities from this polls question filtered by their ``type`` attribute as
        the key, and the text that each entity belongs to as the value of the :obj:`dict`.

        .. versionadded:: 21.2

        Note:
            This method should always be used instead of the :attr:`question_entities`
            attribute, since it calculates the correct substring from the message text based on
            UTF-16 codepoints. See :attr:`parse_question_entity` for more info.

        Args:
            types (list[:obj:`str`], optional): List of ``MessageEntity`` types as strings. If the
                    ``type`` attribute of an entity is contained in this list, it will be returned.
                    Defaults to :attr:`telegram.MessageEntity.ALL_TYPES`.

        Returns:
            dict[:class:`telegram.MessageEntity`, :obj:`str`]: A dictionary of entities mapped to
            the text that belongs to them, calculated based on UTF-16 codepoints.

        )r   r­   r®   rk   r:   r:   r;   Úparse_question_entities’  s   zPoll.parse_question_entitiesc                 C   r·   )a  Returns the text in :attr:`description` from a given :class:`telegram.MessageEntity` of
        :attr:`description_entities`.

        .. versionadded:: 22.8

        Note:
            This method is present because Telegram calculates the offset and length in
            UTF-16 codepoint pairs, which some versions of Python don't handle automatically.
            (That is, you can't just slice ``Message.text`` with the offset and length.)

        Args:
            entity (:class:`telegram.MessageEntity`): The entity to extract the text from. It must
                be an entity that belongs to :attr:`description_entities`.

        Returns:
            :obj:`str`: The text of the given entity.

        Raises:
            RuntimeError: If the poll has no description.

        úThis Poll has no 'description'.)r£   r¹   r   rf   r:   r:   r;   Úparse_description_entity«  s   zPoll.parse_description_entityc                 C   r»   )a‡  
        Returns a :obj:`dict` that maps :class:`telegram.MessageEntity` to :obj:`str`.
        It contains entities from this polls description filtered by their ``type`` attribute as
        the key, and the text that each entity belongs to as the value of the :obj:`dict`.

        .. versionadded:: 22.8

        Note:
            This method should always be used instead of the :attr:`description_entities`
            attribute, since it calculates the correct substring from the message text based on
            UTF-16 codepoints. See :attr:`parse_description_entity` for more info.

        Args:
            types (list[:obj:`str`], optional): List of ``MessageEntity`` types as strings. If the
                    ``type`` attribute of an entity is contained in this list, it will be returned.
                    Defaults to :attr:`telegram.MessageEntity.ALL_TYPES`.
        Returns:
            dict[:class:`telegram.MessageEntity`, :obj:`str`]: A dictionary of entities
            mapped to the text that belongs to them, calculated based on UTF-16 codepoints.
        Raises:
            RuntimeError: If the poll has no description.
        r¿   )r£   r¹   r   r¤   rk   r:   r:   r;   Úparse_description_entitiesÆ  s   zPoll.parse_description_entitiesc                 C   s&   t tddƒdd� | jr| jd S dS )a!  A zero based identifier of the correct answer
        option. Available only for closed polls in the quiz mode, which were sent
        (not forwarded), by the bot or to a private chat with the bot.

        .. deprecated:: 22.8
            Use :attr:`correct_option_ids` instead.
        rT   zRThe attribute `correct_option_id` is deprecated. Use `correct_option_ids` instead.rU   rV   r   N)r!   r"   r¡   r¶   r:   r:   r;   r±   ä  s   	þúzPoll.correct_option_idÚREGULARÚQUIZÚMAX_EXPLANATION_LENGTHÚMAX_EXPLANATION_LINE_FEEDSÚMIN_OPEN_PERIODÚMAX_OPEN_PERIODÚMIN_QUESTION_LENGTHÚMAX_QUESTION_LENGTHrv   rx   ÚMIN_OPTION_NUMBERÚMAX_OPTION_NUMBERÚMAX_DESCRIPTION_CHARACTERSÚMIN_MEMBERSHIP_HOURS)NNNNNNNNNNNNNNrG   )3rH   rI   rJ   rK   rL   rX   r   rY   rp   Úboolr   r    rq   rr   r&   r   r4   ÚpropertyÚ	timedeltar²   rM   rD   rº   rs   rt   r¼   r½   r¾   rÀ   rÁ   r±   r   r´   rÂ   r   rw   rÃ   ru   rÄ   rÅ   rÆ   rÇ   rÈ   rÉ   rv   rx   rÊ   rË   rÌ   rÍ   rN   r:   r:   r8   r;   rœ     sê   
  ,$ãáþýüûúùø	÷ôò
ñðï
îëê
èç
æ
åäãáTÿ
ÿ

þ$ÿ
ÿ

þrœ   )FrK   rr   rq   Úcollections.abcr   Útypingr   r   Útelegramr   Útelegram._chatr   Útelegram._files.animationr   Útelegram._files.audior   Útelegram._files.documentr	   Útelegram._files.livephotor
   Útelegram._files.locationr   Útelegram._files.photosizer   Útelegram._files.stickerr   Útelegram._files.venuer   Útelegram._files.videor   Útelegram._messageentityr   Útelegram._telegramobjectr   Útelegram._userr   Útelegram._utilsr   Útelegram._utils.argumentparsingr   r   r   r   Útelegram._utils.datetimer   r   r   Útelegram._utils.defaultvaluer   Útelegram._utils.entitiesr   r   Útelegram._utils.typesr   r   r    Útelegram._utils.warningsr!   Útelegram.warningsr"   r#   r$   r%   r&   rO   rY   ry   r€   r›   rœ   r:   r:   r:   r;   Ú<module>   sH   sV ?hss