o
    "h6                     @   sr   d Z ddlZddl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 er.ddlmZ eG dd	 d	ZdS )
z\This module contains the class Defaults, which allows passing default values to Application.    N)TYPE_CHECKINGAnyNoReturnOptionalfinal)UTC)warn)PTBDeprecationWarning)LinkPreviewOptionsc                   @   s  e Zd ZdZdZddedddddfdee dee de	j
ded	ee d
ee ded dee fddZdefddZdedefddZedeeef fddZedee fddZejdedefddZedee fddZejdedefddZedee fdd Zejdedefd!d Zedee fd"d#Zejdedefd$d#Zedee fd%d&Zejdedefd'd&Zedee fd(d)Zejdedefd*d)Zedee fd+d,Zejdedefd-d,Zede	j
fd.d/Z
e
jdedefd0d/Z
edefd1d2Zejdedefd3d2Zedee fd4d5Zejdedefd6d5Zeded fd7d8Zedee fd9d:Z dS );Defaultsa  Convenience Class to gather all parameters with a (user defined) default value

    .. seealso:: :wiki:`Architecture Overview <Architecture>`,
        :wiki:`Adding Defaults to Your Bot <Adding-defaults-to-your-bot>`

    .. versionchanged:: 20.0
        Removed the argument and attribute ``timeout``. Specify default timeout behavior for the
        networking backend directly via :class:`telegram.ext.ApplicationBuilder` instead.

    .. versionchanged:: 22.0
        Removed deprecated arguments and properties ``disable_web_page_preview`` and ``quote``.
        Use :paramref:`link_preview_options` and :paramref:`do_quote` instead.

    Parameters:
        parse_mode (:obj:`str`, optional): |parse_mode|
        disable_notification (:obj:`bool`, optional): |disable_notification|
        allow_sending_without_reply (:obj:`bool`, optional): |allow_sending_without_reply|.
            Will be used for :attr:`telegram.ReplyParameters.allow_sending_without_reply`.
        tzinfo (:class:`datetime.tzinfo`, optional): A timezone to be used for all date(time)
            inputs appearing throughout PTB, i.e. if a timezone naive date(time) object is passed
            somewhere, it will be assumed to be in :paramref:`tzinfo`. Defaults to
            :attr:`datetime.timezone.utc` otherwise.

            .. deprecated:: 21.10
                Support for ``pytz`` timezones is deprecated and will be removed in future
                versions.

        block (:obj:`bool`, optional): Default setting for the :paramref:`BaseHandler.block`
            parameter
            of handlers and error handlers registered through :meth:`Application.add_handler` and
            :meth:`Application.add_error_handler`. Defaults to :obj:`True`.
        protect_content (:obj:`bool`, optional): |protect_content|

            .. versionadded:: 20.0
        link_preview_options (:class:`telegram.LinkPreviewOptions`, optional):
            Link preview generation options for all outgoing messages. Mutually exclusive with
            :paramref:`disable_web_page_preview`.
            This object is used for the corresponding parameter of
            :meth:`telegram.Bot.send_message`, :meth:`telegram.Bot.edit_message_text`,
            and :class:`telegram.InputTextMessageContent` if not specified. If a value is specified
            for the corresponding parameter, only those parameters of
            :class:`telegram.LinkPreviewOptions` will be overridden that are not
            explicitly set.

            Example:

                .. code-block:: python

                    from telegram import LinkPreviewOptions
                    from telegram.ext import Defaults, ExtBot

                    defaults = Defaults(
                        link_preview_options=LinkPreviewOptions(show_above_text=True)
                    )
                    chat_id = 123

                    async def main():
                        async with ExtBot("Token", defaults=defaults) as bot:
                            # The link preview will be shown above the text.
                            await bot.send_message(chat_id, "https://python-telegram-bot.org")

                            # The link preview will be shown below the text.
                            await bot.send_message(
                                chat_id,
                                "https://python-telegram-bot.org",
                                link_preview_options=LinkPreviewOptions(show_above_text=False)
                            )

                            # The link preview will be shown above the text, but the preview will
                            # show Telegram.
                            await bot.send_message(
                                chat_id,
                                "https://python-telegram-bot.org",
                                link_preview_options=LinkPreviewOptions(url="https://telegram.org")
                            )

            .. versionadded:: 20.8
        do_quote(:obj:`bool`, optional): |reply_quote|

            .. versionadded:: 20.8
    )	_allow_sending_without_reply_api_defaults_block_disable_notification	_do_quote_link_preview_options_parse_mode_protect_content_tzinfoNT
parse_modedisable_notificationtzinfoblockallow_sending_without_replyprotect_contentlink_preview_optionsr
   do_quotec	                 C   s   || _ || _|| _|| _|| _|| _dt| jjv r$tt	ddddd || _
|| _i | _dD ]}	t| |	}
|
d ur?|
| j|	< q/d S )Npytzz21.10zPSupport for pytz timezones is deprecated and will be removed in future versions.)versionmessage   )r   
stacklevel)	r   r   r   explanation_parse_moder   r   text_parse_moder   question_parse_mode)r   r   r   r   r   r   str	__class__r   r	   r   r   r   getattr)selfr   r   r   r   r   r   r   r   kwargvalue r+   I/var/www/html/venv/lib/python3.10/site-packages/telegram/ext/_defaults.py__init__   s.   

zDefaults.__init__returnc              	   C   s(   t | j| j| j| j| j| j| j| jfS )zBuilds a hash value for this object such that the hash of two objects is equal if and
        only if the objects are equal in terms of :meth:`__eq__`.

        Returns:
            :obj:`int` The hash value of the object.
        )	hashr   r   r   r   r   r   r   r   r(   r+   r+   r,   __hash__   s   zDefaults.__hash__otherc                    s(   t  trt fddjD S dS )a"  Defines equality condition for the :class:`Defaults` object.
        Two objects of this class are considered to be equal if all their parameters
        are identical.

        Returns:
            :obj:`True` if both objects have all parameters identical. :obj:`False` otherwise.
        c                 3   s$    | ]}t |t  |kV  qd S N)r'   ).0attrr2   r(   r+   r,   	<genexpr>   s   " z"Defaults.__eq__.<locals>.<genexpr>F)
isinstancer   all	__slots__)r(   r2   r+   r6   r,   __eq__   s   
zDefaults.__eq__c                 C      | j S r3   )r   r0   r+   r+   r,   api_defaults   s   zDefaults.api_defaultsc                 C   r<   )z:obj:`str`: Optional. Send Markdown or HTML, if you want Telegram apps to show
        bold, italic, fixed-width text or URLs in your bot's message.
        r   r0   r+   r+   r,   r         zDefaults.parse_mode_c                 C      t d)NzBYou can not assign a new value to parse_mode after initialization.AttributeErrorr(   r@   r+   r+   r,   r         c                 C   r<   )z:obj:`str`: Optional. Alias for :attr:`parse_mode`, used for
        the corresponding parameter of :meth:`telegram.Bot.send_poll`.
        r>   r0   r+   r+   r,   r"      r?   zDefaults.explanation_parse_modec                 C   rA   )NzNYou can not assign a new value to explanation_parse_mode after initialization.rB   rD   r+   r+   r,   r"         c                 C   r<   )z:obj:`str`: Optional. Alias for :attr:`parse_mode`, used for
        the corresponding parameter of :meth:`telegram.ReplyParameters`.
        r>   r0   r+   r+   r,   quote_parse_mode   r?   zDefaults.quote_parse_modec                 C   rA   )NzHYou can not assign a new value to quote_parse_mode after initialization.rB   rD   r+   r+   r,   rG      rF   c                 C   r<   )z:obj:`str`: Optional. Alias for :attr:`parse_mode`, used for
        the corresponding parameter of :class:`telegram.InputPollOption` and
        :meth:`telegram.Bot.send_gift`.

        .. versionadded:: 21.2
        r>   r0   r+   r+   r,   r#      s   zDefaults.text_parse_modec                 C   rA   )NzGYou can not assign a new value to text_parse_mode after initialization.rB   rD   r+   r+   r,   r#     rF   c                 C   r<   )z:obj:`str`: Optional. Alias for :attr:`parse_mode`, used for
        the corresponding parameter of :meth:`telegram.Bot.send_poll`.

        .. versionadded:: 21.2
        r>   r0   r+   r+   r,   r$        zDefaults.question_parse_modec                 C   rA   )NzKYou can not assign a new value to question_parse_mode after initialization.rB   rD   r+   r+   r,   r$     rF   c                 C   r<   )zt:obj:`bool`: Optional. Sends the message silently. Users will
        receive a notification with no sound.
        )r   r0   r+   r+   r,   r     r?   zDefaults.disable_notificationc                 C   rA   )NzLYou can not assign a new value to disable_notification after initialization.rB   rD   r+   r+   r,   r   !  rF   c                 C   r<   )z:obj:`bool`: Optional. Pass :obj:`True`, if the message
        should be sent even if the specified replied-to message is not found.
        )r   r0   r+   r+   r,   r   '  r?   z$Defaults.allow_sending_without_replyc                 C   rA   )NzSYou can not assign a new value to allow_sending_without_reply after initialization.rB   rD   r+   r+   r,   r   .  rF   c                 C   r<   )zj:obj:`tzinfo`: A timezone to be used for all date(time) objects appearing
        throughout PTB.
        )r   r0   r+   r+   r,   r   4  r?   zDefaults.tzinfoc                 C   rA   )Nz>You can not assign a new value to tzinfo after initialization.rB   rD   r+   r+   r,   r   ;  rE   c                 C   r<   )z:obj:`bool`: Optional. Default setting for the :paramref:`BaseHandler.block` parameter
        of handlers and error handlers registered through :meth:`Application.add_handler` and
        :meth:`Application.add_error_handler`.
        )r   r0   r+   r+   r,   r   ?     zDefaults.blockc                 C   rA   )Nz=You can not assign a new value to block after initialization.rB   rD   r+   r+   r,   r   G  rE   c                 C   r<   )z:obj:`bool`: Optional. Protects the contents of the sent message from forwarding and
        saving.

        .. versionadded:: 20.0
        )r   r0   r+   r+   r,   r   K  rH   zDefaults.protect_contentc                 C   rA   )NzEYou can't assign a new value to protect_content after initialization.rB   rD   r+   r+   r,   r   T  rF   c                 C   r<   )z:class:`telegram.LinkPreviewOptions`: Optional. Link preview generation options for all
        outgoing messages.

        .. versionadded:: 20.8
        )r   r0   r+   r+   r,   r   Z  rH   zDefaults.link_preview_optionsc                 C   r<   )zM:obj:`bool`: Optional. |reply_quote|

        .. versionadded:: 20.8
        )r   r0   r+   r+   r,   r   c  rI   zDefaults.do_quote)!__name__
__module____qualname____doc__r:   r   r   r%   booldtmr   r-   intr1   objectr;   propertydictr   r=   r   setterr   r"   rG   r#   r$   r   r   r   r   r   r   r+   r+   r+   r,   r      s    R	
3	r   )rM   datetimerO   typingr   r   r   r   r   telegram._utils.datetimer   telegram._utils.warningsr   telegram.warningsr	   telegramr
   r   r+   r+   r+   r,   <module>   s   