
    ՟f?                     r   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rddl
mZ  G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z  G d de      Z! G d de      Z" G d de      Z# G d de      Z$y) 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                   @     e Zd ZdZdZdddedee   ddf fdZ x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                x    t         |   |       || _        | j                  f| _        | j	                          y Nr   )super__init__r   	_id_attrs_freeze)selfr   r   	__class__s      N/var/www/cvtools/html/venv/lib/python3.12/site-packages/telegram/_chatboost.pyr   zChatBoostAdded.__init__9   s6     	J/ +**,    )
__name__
__module____qualname____doc__	__slots__intr   r   r   __classcell__r"   s   @r#   r   r   %   s?    " !I *.	

 X&	

 

 
r$   r   c            	       0    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
Ze	 ddee   ded   ded    f fd       Z x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                    t         |   |       t        j                  t        j
                  ||      | _        | j                  f| _        | j                          y r   )	r   r   r   
get_memberr   ChatBoostSourcesr/   r   r    )r!   r/   r   r"   s      r#   r   zChatBoostSource.__init__g   sE    J/  ??9+E+EvvV++r$   databotr   r   c                    | j                  |      }|sy| j                  t        | j                  t        | j
                  t        i}| t        u r8|j                  d      |v r%||j                  d         j                  ||      S d|v r(t        j                  |j                  d      |      |d<   t        | )  ||      S ),See :meth:`telegram.TelegramObject.de_json`.Nr/   r6   r7   user)_parse_datar0   ChatBoostSourcePremiumr1   ChatBoostSourceGiftCoder2   ChatBoostSourceGiveawayr.   getpopde_jsonr   r   )clsr6   r7   _class_mappingr"   s       r#   rB   zChatBoostSource.de_jsonp   s    
 t$ KK/MM2LL1<
 /!dhhx&8N&J!$((8"45==4S=QQT><<(8#>DLwDc22r$   N)r%   r&   r'   r(   r)   r   r5   r0   r   str__annotations__r1   r2   r   r   r   classmethodrB   r+   r,   s   @r#   r.   r.   F   s    . I#44<<GU3Z<>%66@@IuSz@@$55>>HeCj>?HL s 8H3E  >B3H%3,4UO3	#	$3 3r$   r.   c                   <     e Zd ZdZdZdddedee   f fdZ xZ	S )r=   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.
    r;   Nr   r;   r   c                    t         |   | j                  |       | j                         5  || _        d d d        y # 1 sw Y   y xY wN)r/   r   )r   r   r0   	_unfrozenr;   r!   r;   r   r"   s      r#   r   zChatBoostSourcePremium.__init__   s?    D^^ 	#"DI	# 	# 	#	   >A
r%   r&   r'   r(   r)   r   r   r   r   r+   r,   s   @r#   r=   r=      s/     IGK #T #(82D # #r$   r=   c                   <     e Zd ZdZdZdddedee   f fdZ xZ	S )r>   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.
    rJ   Nr   r;   r   c                    t         |   | j                  |       | j                         5  || _        d d d        y # 1 sw Y   y xY wrL   )r   r   r1   rM   r;   rN   s      r#   r   z ChatBoostSourceGiftCode.__init__   s?    :F^^ 	#"DI	# 	# 	#rO   rP   r,   s   @r#   r>   r>      s/      IGK #T #(82D # #r$   r>   c                   b     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
Z
 xZS )r?   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_countr;   Nr   rT   r;   rU   rV   r   c                    t         |   | j                  |       | j                         5  || _        || _        || _        || _        d d d        y # 1 sw Y   y xY wrL   )r   r   r2   rM   rT   r;   rV   rU   )r!   rT   r;   rU   rV   r   r"   s         r#   r   z ChatBoostSourceGiveaway.__init__   sY     	*E^^ 	=,?D$(,DI3CD!0<D		= 	= 	=s   AA)NNN)r%   r&   r'   r(   r)   r*   r   r   boolr   r   r+   r,   s   @r#   r?   r?      sq     D TI
  $'+*.= *.= = tn= tn	=
 #3-= X&= =r$   r?   c                        e Zd ZdZdZdddedededed	ee	   f
 fd
Z
e	 ddee	   ded   ded    f fd       Z x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   r\   r[   r]   r/   r   c                    t         |   |       || _        || _        || _        || _        | j                  | j                  | j                  | j
                  f| _        | j                          y r   )r   r   r\   r[   r]   r/   r   r    )r!   r\   r[   r]   r/   r   r"   s         r#   r   zChatBoost.__init__  s]     	J/%"*)8'---8L8LdkkZr$   r6   r7   r   r   c                     | j                  |      }|syt        j                  |j                  d      |      |d<   t	        |      }t        |d   |      |d<   t        |d   |      |d<   t        | 	  ||      S )r9   Nr/   r[   tzinfor]   r:   )r<   r.   rB   r@   r   r   r   rC   r6   r7   
loc_tzinfor"   s       r#   rB   zChatBoost.de_json$  s    
 t$(00(1CSIX1#6
)$z*::NZ"06G1HQ["\wDc22r$   rE   )r%   r&   r'   r(   r)   rF   r   r.   r   r   r   rH   rB   r+   r,   s   @r#   rZ   rZ      s    6 FI *.  "	
   X&& >B3H%3,4UO3	+	3 3r$   rZ   c            	       x     e Zd ZdZdZdddededee   f fdZ	e
	 dd	ee   d
ed   ded    f fd       Z x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   rg   rf   r   c                    t         |   |       || _        || _        | j                  j                  | j                  f| _        | j                          y r   )r   r   rg   rf   idr   r    )r!   rg   rf   r   r"   s       r#   r   zChatBoostUpdated.__init__I  sD     	J/	 %
)),,

3r$   r6   r7   r   r   c                     | j                  |      }|syt        j                  |j                  d      |      |d<   t        j                  |j                  d      |      |d<   t
        | 	  ||      S )r9   Nrg   rf   r:   )r<   r   rB   r@   rZ   r   rC   r6   r7   r"   s      r#   rB   zChatBoostUpdated.de_jsonX  sh    
 t$||DHHV$4c:V!))$((7*;SAWwDc22r$   rE   )r%   r&   r'   r(   r)   r   rZ   r   r   r   rH   rB   r+   r,   s   @r#   re   re   6  sx      "I *. 
 X& >B3H%3,4UO3	$	%3 3r$   re   c                        e Zd ZdZdZdddedededed	e	e
   f
 fd
Ze	 dde	e
   de	d   de	d    f fd       Z x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.
    )r\   rg   remove_dater/   Nr   rg   r\   rn   r/   r   c                    t         |   |       || _        || _        || _        || _        | j                  | j                  | j                  | j
                  f| _        | j                          y r   )r   r   rg   r\   rn   r/   r   r    )r!   rg   r\   rn   r/   r   r"   s         r#   r   zChatBoostRemoved.__init__  s]     	J/	%%0'-))T]]D4D4DdkkRr$   r6   r7   r   r   c                 *   | j                  |      }|syt        j                  |j                  d      |      |d<   t        j                  |j                  d      |      |d<   t        |      }t        |d   |      |d<   t        | 	  ||      S )r9   Nrg   r/   rn   r`   r:   )r<   r   rB   r@   r.   r   r   r   rb   s       r#   rB   zChatBoostRemoved.de_json  s    
 t$||DHHV$4c:V(00(1CSIX1#6
,T--@T]wDc22r$   rE   )r%   r&   r'   r(   r)   r   rF   r   r.   r   r   r   rH   rB   r+   r,   s   @r#   rm   rm   h  s    * >I *.  	
   X&& >B3H%3,4UO3	$	%3 3r$   rm   c            	       z     e Zd ZdZdZdddee   dee   f fdZ	e
	 ddee   d	ed
   ded    f fd       Z x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   rs   r   c                    t         |   |       t        |      | _        | j                  f| _        | j                          y r   )r   r   r   rs   r   r    )r!   rs   r   r"   s      r#   r   zUserChatBoosts.__init__  s7     	J/-?-G++r$   r6   r7   r   r   c                     | j                  |      }|syt        j                  |j                  d      |      |d<   t        |   ||      S )r9   Nrs   r:   )r<   rZ   de_listr@   r   rB   rk   s      r#   rB   zUserChatBoosts.de_json  sK    
 t$"**488H+=sCXwDc22r$   rE   )r%   r&   r'   r(   r)   r   rZ   r   r   r   rH   rB   r+   r,   s   @r#   rr   rr     ss     I *.	# X&	 >B3H%3,4UO3	"	#3 3r$   rr   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.   r=   r>   r?   rZ   re   rm   rr    r$   r#   <module>r      s   & K  N N N   3    > Q *^ B@3n @3F#_ #2#o #44=o 4=n@3 @3F/3~ /3d:3~ :3z+3^ +3r$   