o
    / hâ?  ã                   @   s<  d Z ddlmZ ddlmZmZmZmZmZ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mZ ddlmZ erTddl
mZ G dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZ G dd„ deƒZ!G dd„ deƒZ"G dd„ deƒZ#G dd„ deƒZ$dS ) zDThis module contains the classes that represent Telegram ChatBoosts.é    )Údatetime)ÚTYPE_CHECKINGÚDictÚFinalÚOptionalÚSequenceÚTupleÚType)Ú	constants)ÚChat)ÚTelegramObject)ÚUser)Úenum)Úparse_sequence_arg)Úextract_tzinfo_from_defaultsÚfrom_timestamp)ÚJSONDict)ÚBotc                       s<   e Zd ZdZdZddœdedee ddf‡ fdd	„Z‡  Z	S )
ÚChatBoostAddedaµ  
    This object represents a service message about a user boosting a chat.

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

    .. versionadded:: 21.0

    Args:
        boost_count (:obj:`int`): Number of boosts added by the user.

    Attributes:
        boost_count (:obj:`int`): Number of boosts added by the user.

    )Úboost_countN©Ú
api_kwargsr   r   Úreturnc                   s*   t ƒ j|d || _| jf| _|  ¡  d S ©Nr   )ÚsuperÚ__init__r   Ú	_id_attrsÚ_freeze)Úselfr   r   ©Ú	__class__© úL/var/www/html/govbot/env/lib/python3.10/site-packages/telegram/_chatboost.pyr   9   s   
zChatBoostAdded.__init__)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__Úintr   r   r   Ú__classcell__r!   r!   r   r"   r   %   s    üþüûr   c                	       sª   e Zd ZU dZdZejjZee	 e
d< 	 ejjZee	 e
d< 	 ejjZee	 e
d< 	 ddœde	d	ee f‡ fd
d„Ze	ddee ded ded  f‡ fdd„ƒZ‡  ZS )ÚChatBoostSourcea|  
    Base class for Telegram ChatBoostSource objects. It can be one of:

    * :class:`telegram.ChatBoostSourcePremium`
    * :class:`telegram.ChatBoostSourceGiftCode`
    * :class:`telegram.ChatBoostSourceGiveaway`

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

    .. versionadded:: 20.8

    Args:
        source (:obj:`str`): The source of the chat boost. Can be one of:
            :attr:`~telegram.ChatBoostSource.PREMIUM`, :attr:`~telegram.ChatBoostSource.GIFT_CODE`,
            or :attr:`~telegram.ChatBoostSource.GIVEAWAY`.

    Attributes:
        source (:obj:`str`): The source of the chat boost. Can be one of:
            :attr:`~telegram.ChatBoostSource.PREMIUM`, :attr:`~telegram.ChatBoostSource.GIFT_CODE`,
            or :attr:`~telegram.ChatBoostSource.GIVEAWAY`.
    )ÚsourceÚPREMIUMÚ	GIFT_CODEÚGIVEAWAYNr   r+   r   c                   s6   t ƒ j|d t tj||¡| _| jf| _|  ¡  d S r   )	r   r   r   Ú
get_memberr
   ÚChatBoostSourcesr+   r   r   )r   r+   r   r   r!   r"   r   g   s   
zChatBoostSource.__init__ÚdataÚbotr   r   c                    s„   |   |¡}|s	dS | jt| jt| jti}| tu r+| d¡|v r+|| 	d¡ j
||dS d|v r:t 
| d¡|¡|d< tƒ j
||dS )ú,See :meth:`telegram.TelegramObject.de_json`.Nr+   ©r1   r2   Úuser)Ú_parse_datar,   ÚChatBoostSourcePremiumr-   ÚChatBoostSourceGiftCoder.   ÚChatBoostSourceGiveawayr*   ÚgetÚpopÚde_jsonr   r   )Úclsr1   r2   Ú_class_mappingr   r!   r"   r<   p   s   
ýzChatBoostSource.de_json©N)r#   r$   r%   r&   r'   r
   r0   r,   r   ÚstrÚ__annotations__r-   r.   r   r   r   Úclassmethodr<   r)   r!   r!   r   r"   r*   F   s&   
  	ÿÿÿþr*   c                       ó8   e Zd ZdZdZddœdedee f‡ fdd„Z‡  Z	S )	r7   a½  
    The boost was obtained by subscribing to Telegram Premium or by gifting a Telegram Premium
    subscription to another user.

    .. versionadded:: 20.8

    Args:
        user (:class:`telegram.User`): User that boosted the chat.

    Attributes:
        source (:obj:`str`): The source of the chat boost. Always
            :attr:`~telegram.ChatBoostSource.PREMIUM`.
        user (:class:`telegram.User`): User that boosted the chat.
    ©r5   Nr   r5   r   c                   óF   t ƒ j| j|d |  ¡  || _W d   ƒ d S 1 sw   Y  d S ©N)r+   r   )r   r   r,   Ú	_unfrozenr5   ©r   r5   r   r   r!   r"   r   ›   ó   
"ÿzChatBoostSourcePremium.__init__©
r#   r$   r%   r&   r'   r   r   r   r   r)   r!   r!   r   r"   r7   ‰   s    (r7   c                       rC   )	r8   a)  
    The boost was obtained by the creation of Telegram Premium gift codes to boost a chat. Each
    such code boosts the chat 4 times for the duration of the corresponding Telegram Premium
    subscription.

    .. versionadded:: 20.8

    Args:
        user (:class:`telegram.User`): User for which the gift code was created.

    Attributes:
        source (:obj:`str`): The source of the chat boost. Always
            :attr:`~telegram.ChatBoostSource.GIFT_CODE`.
        user (:class:`telegram.User`): User for which the gift code was created.
    rD   Nr   r5   r   c                   rE   rF   )r   r   r-   rG   r5   rH   r   r!   r"   r   µ   rI   z ChatBoostSourceGiftCode.__init__rJ   r!   r!   r   r"   r8   ¢   s    (r8   c                       sX   e Zd ZdZdZ			dddœdedee dee dee d	ee	 f
‡ fd
d„Z
‡  ZS )r9   a
  
    The boost was obtained by the creation of a Telegram Premium giveaway or a Telegram Star.
    This boosts the chat 4 times for the duration of the corresponding Telegram Premium
    subscription for Telegram Premium giveaways and :attr:`prize_star_count` / 500 times for
    one year for Telegram Star giveaways.

    .. versionadded:: 20.8

    Args:
        giveaway_message_id (:obj:`int`): Identifier of a message in the chat with the giveaway;
            the message could have been deleted already. May be 0 if the message isn't sent yet.
        user (:class:`telegram.User`, optional): User that won the prize in the giveaway if any;
            for Telegram Premium giveaways only.
        prize_star_count (:obj:`int`, optional): The number of Telegram Stars to be split between
            giveaway winners; for Telegram Star giveaways only.

            .. versionadded:: 21.6
        is_unclaimed (:obj:`bool`, optional): :obj:`True`, if the giveaway was completed, but
            there was no user to win the prize.

    Attributes:
        source (:obj:`str`): Source of the boost. Always
            :attr:`~telegram.ChatBoostSource.GIVEAWAY`.
        giveaway_message_id (:obj:`int`): Identifier of a message in the chat with the giveaway;
            the message could have been deleted already. May be 0 if the message isn't sent yet.
        user (:class:`telegram.User`): Optional. User that won the prize in the giveaway if any.
        prize_star_count (:obj:`int`): Optional. The number of Telegram Stars to be split between
            giveaway winners; for Telegram Star giveaways only.

            .. versionadded:: 21.6
        is_unclaimed (:obj:`bool`): Optional. :obj:`True`, if the giveaway was completed, but
            there was no user to win the prize.
    )Úgiveaway_message_idÚis_unclaimedÚprize_star_countr5   Nr   rK   r5   rL   rM   r   c                   sX   t ƒ j| j|d |  ¡  || _|| _|| _|| _W d   ƒ d S 1 s%w   Y  d S rF   )r   r   r.   rG   rK   r5   rM   rL   )r   rK   r5   rL   rM   r   r   r!   r"   r   á   s   	
"üz ChatBoostSourceGiveaway.__init__)NNN)r#   r$   r%   r&   r'   r(   r   r   Úboolr   r   r)   r!   r!   r   r"   r9   ¼   s&    "ûùþýüûùr9   c                       sr   e Zd ZdZdZddœdedededed	ee	 f
‡ fd
d„Z
e	ddee	 ded ded  f‡ fdd„ƒZ‡  ZS )Ú	ChatBoostaà  
    This object contains information about a chat boost.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`boost_id`, :attr:`add_date`, :attr:`expiration_date`,
    and :attr:`source` are equal.

    .. versionadded:: 20.8

    Args:
        boost_id (:obj:`str`): Unique identifier of the boost.
        add_date (:obj:`datetime.datetime`): Point in time when the chat was boosted.
        expiration_date (:obj:`datetime.datetime`): Point in time when the boost
            will automatically expire, unless the booster's Telegram Premium subscription is
            prolonged.
        source (:class:`telegram.ChatBoostSource`): Source of the added boost.

    Attributes:
        boost_id (:obj:`str`): Unique identifier of the boost.
        add_date (:obj:`datetime.datetime`): Point in time when the chat was boosted.
            |datetime_localization|
        expiration_date (:obj:`datetime.datetime`): Point in time when the boost
            will automatically expire, unless the booster's Telegram Premium subscription is
            prolonged. |datetime_localization|
        source (:class:`telegram.ChatBoostSource`): Source of the added boost.
    )Úadd_dateÚboost_idÚexpiration_dater+   Nr   rQ   rP   rR   r+   r   c                   óH   t ƒ j|d || _|| _|| _|| _| j| j| j| jf| _|  ¡  d S r   )r   r   rQ   rP   rR   r+   r   r   )r   rQ   rP   rR   r+   r   r   r!   r"   r     ó   	zChatBoost.__init__r1   r2   r   r   c                    sh   |   |¡}|s	dS t | d¡|¡|d< t|ƒ}t|d |d|d< t|d |d|d< tƒ j||dS )r3   Nr+   rP   ©ÚtzinforR   r4   )r6   r*   r<   r:   r   r   r   ©r=   r1   r2   Ú
loc_tzinfor   r!   r"   r<   $  s   
zChatBoost.de_jsonr?   )r#   r$   r%   r&   r'   r@   r   r*   r   r   r   rB   r<   r)   r!   r!   r   r"   rO   ó   s0    	ùþýüûùÿÿÿþrO   c                	       sj   e Zd ZdZdZddœdededee f‡ fdd	„Z	e
	dd
ee ded ded  f‡ fdd„ƒZ‡  ZS )ÚChatBoostUpdateda;  This object represents a boost added to a chat or changed.

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

    .. versionadded:: 20.8

    Args:
        chat (:class:`telegram.Chat`): Chat which was boosted.
        boost (:class:`telegram.ChatBoost`): Information about the chat boost.

    Attributes:
        chat (:class:`telegram.Chat`): Chat which was boosted.
        boost (:class:`telegram.ChatBoost`): Information about the chat boost.
    )ÚboostÚchatNr   r[   rZ   r   c                   s6   t ƒ j|d || _|| _| jj| jf| _|  ¡  d S r   )r   r   r[   rZ   Úidr   r   )r   r[   rZ   r   r   r!   r"   r   I  s
   zChatBoostUpdated.__init__r1   r2   r   r   c                    sN   |   |¡}|s	dS t | d¡|¡|d< t | d¡|¡|d< tƒ j||dS )r3   Nr[   rZ   r4   )r6   r   r<   r:   rO   r   ©r=   r1   r2   r   r!   r"   r<   X  s   
zChatBoostUpdated.de_jsonr?   )r#   r$   r%   r&   r'   r   rO   r   r   r   rB   r<   r)   r!   r!   r   r"   rY   6  s(    ûþýûÿÿÿþrY   c                       sr   e Zd ZdZdZddœdedededed	e	e
 f
‡ fd
d„Ze	dde	e
 de	d de	d  f‡ fdd„ƒZ‡  ZS )ÚChatBoostRemoveda£  
    This object represents a boost removed from a chat.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`chat`, :attr:`boost_id`, :attr:`remove_date`, and
    :attr:`source` are equal.

    Args:
        chat (:class:`telegram.Chat`): Chat which was boosted.
        boost_id (:obj:`str`): Unique identifier of the boost.
        remove_date (:obj:`datetime.datetime`): Point in time when the boost was removed.
        source (:class:`telegram.ChatBoostSource`): Source of the removed boost.

    Attributes:
        chat (:class:`telegram.Chat`): Chat which was boosted.
        boost_id (:obj:`str`): Unique identifier of the boost.
        remove_date (:obj:`datetime.datetime`): Point in time when the boost was removed.
            |datetime_localization|
        source (:class:`telegram.ChatBoostSource`): Source of the removed boost.
    )rQ   r[   Úremove_dater+   Nr   r[   rQ   r_   r+   r   c                   rS   r   )r   r   r[   rQ   r_   r+   r   r   )r   r[   rQ   r_   r+   r   r   r!   r"   r   €  rT   zChatBoostRemoved.__init__r1   r2   r   r   c                    sj   |   |¡}|s	dS t | d¡|¡|d< t | d¡|¡|d< t|ƒ}t|d |d|d< tƒ j||dS )r3   Nr[   r+   r_   rU   r4   )r6   r   r<   r:   r*   r   r   r   rW   r   r!   r"   r<   “  s   
zChatBoostRemoved.de_jsonr?   )r#   r$   r%   r&   r'   r   r@   r   r*   r   r   r   rB   r<   r)   r!   r!   r   r"   r^   h  s0    	ùþýüûùÿÿÿþr^   c                	       sj   e Zd ZdZdZddœdee dee f‡ fdd„Z	e
	dd	ee d
ed ded  f‡ fdd„ƒZ‡  ZS )ÚUserChatBoostsaë  This object represents a list of boosts added to a chat by a user.

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

    .. versionadded:: 20.8

    Args:
        boosts (Sequence[:class:`telegram.ChatBoost`]): List of boosts added to the chat by the
            user.

    Attributes:
        boosts (Tuple[:class:`telegram.ChatBoost`]): List of boosts added to the chat by the user.
    )ÚboostsNr   ra   r   c                   s.   t ƒ j|d t|ƒ| _| jf| _|  ¡  d S r   )r   r   r   ra   r   r   )r   ra   r   r   r!   r"   r   ·  s   

zUserChatBoosts.__init__r1   r2   r   r   c                    s8   |   |¡}|s	dS t | d¡|¡|d< tƒ j||dS )r3   Nra   r4   )r6   rO   Úde_listr:   r   r<   r]   r   r!   r"   r<   Ä  s
   
zUserChatBoosts.de_jsonr?   )r#   r$   r%   r&   r'   r   rO   r   r   r   rB   r<   r)   r!   r!   r   r"   r`   ¥  s$    üþüÿÿÿþr`   N)%r&   r   Útypingr   r   r   r   r   r   r	   Útelegramr
   Útelegram._chatr   Útelegram._telegramobjectr   Útelegram._userr   Útelegram._utilsr   Útelegram._utils.argumentparsingr   Útelegram._utils.datetimer   r   Útelegram._utils.typesr   r   r   r*   r7   r8   r9   rO   rY   r^   r`   r!   r!   r!   r"   Ú<module>   s,   $!C7C2=