U
    dd                     @   s|   d Z ddl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 erhddlmZ G d	d
 d
e	ZdS )zHThis module contains an object that represents a Telegram MessageEntity.    )TYPE_CHECKINGClassVarListOptional)	constants)TelegramObject)User)enum)JSONDict)Botc                       s  e Zd ZU dZdZdddeeeeeeeed fddZ	e
ee ded  d	 fd
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< 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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"ejZ#ee$e  ed<   Z%S )MessageEntitya  
    This object represents one special entity in a text message. For example, hashtags,
    usernames, URLs, etc.

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

    Args:
        type (:obj:`str`): Type of the entity. Can be :attr:`MENTION` (@username),
            :attr:`HASHTAG`, :attr:`BOT_COMMAND`,
            :attr:`URL`, :attr:`EMAIL`, :attr:`PHONE_NUMBER`, :attr:`BOLD` (bold text),
            :attr:`ITALIC` (italic text), :attr:`STRIKETHROUGH`, :attr:`SPOILER` (spoiler message),
            :attr:`CODE` (monowidth string), :attr:`PRE` (monowidth block), :attr:`TEXT_LINK` (for
            clickable text URLs), :attr:`TEXT_MENTION` (for users without usernames),
            :attr:`CUSTOM_EMOJI` (for inline custom emoji stickers).

            .. versionadded:: 20.0
                Added inline custom emoji
        offset (:obj:`int`): Offset in UTF-16 code units to the start of the entity.
        length (:obj:`int`): Length of the entity in UTF-16 code units.
        url (:obj:`str`, optional): For :attr:`TEXT_LINK` only, url that will be opened after
            user taps on the text.
        user (:class:`telegram.User`, optional): For :attr:`TEXT_MENTION` only, the mentioned
             user.
        language (:obj:`str`, optional): For :attr:`PRE` only, the programming language of
            the entity text.
        custom_emoji_id (:obj:`str`, optional): For :attr:`CUSTOM_EMOJI` only, unique identifier
            of the custom emoji. Use :meth:`telegram.Bot.get_custom_emoji_stickers` to get full
            information about the sticker.

            .. versionadded:: 20.0
    Attributes:
        type (:obj:`str`): Type of the entity. Can be :attr:`MENTION` (@username),
            :attr:`HASHTAG`, :attr:`BOT_COMMAND`,
            :attr:`URL`, :attr:`EMAIL`, :attr:`PHONE_NUMBER`, :attr:`BOLD` (bold text),
            :attr:`ITALIC` (italic text), :attr:`STRIKETHROUGH`, :attr:`SPOILER` (spoiler message),
            :attr:`CODE` (monowidth string), :attr:`PRE` (monowidth block), :attr:`TEXT_LINK` (for
            clickable text URLs), :attr:`TEXT_MENTION` (for users without usernames),
            :attr:`CUSTOM_EMOJI` (for inline custom emoji stickers).

            .. versionadded:: 20.0
                Added inline custom emoji
        offset (:obj:`int`): Offset in UTF-16 code units to the start of the entity.
        length (:obj:`int`): Length of the entity in UTF-16 code units.
        url (:obj:`str`): Optional. For :attr:`TEXT_LINK` only, url that will be opened after
            user taps on the text.
        user (:class:`telegram.User`): Optional. For :attr:`TEXT_MENTION` only, the mentioned
             user.
        language (:obj:`str`): Optional. For :attr:`PRE` only, the programming language of
            the entity text.
        custom_emoji_id (:obj:`str`): Optional. For :attr:`CUSTOM_EMOJI` only, unique identifier
            of the custom emoji. Use :meth:`telegram.Bot.get_custom_emoji_stickers` to get full
            information about the sticker.

            .. versionadded:: 20.0

    )lengthurlusertypelanguageoffsetcustom_emoji_idN
api_kwargs)r   r   r   r   r   r   r   r   c          	         sb   t  j|d ttj||| _|| _|| _|| _	|| _
|| _|| _| j| j| jf| _|   d S )Nr   )super__init__r	   Z
get_memberr   MessageEntityTyper   r   r   r   r   r   r   Z	_id_attrsZ_freeze)	selfr   r   r   r   r   r   r   r   	__class__ ;/tmp/pip-unpacked-wheel-e3anp165/telegram/_messageentity.pyr   ^   s    zMessageEntity.__init__r   )databotreturnc                    s8   |  |}|sdS t|d||d< t j||dS )z,See :meth:`telegram.TelegramObject.de_json`.Nr   )r   r   )Z_parse_datar   de_jsongetr   )clsr   r   r   r   r   r!   y   s
    
zMessageEntity.de_jsonMENTIONHASHTAGCASHTAGPHONE_NUMBERBOT_COMMANDURLEMAILBOLDITALICCODEPRE	TEXT_LINKTEXT_MENTION	UNDERLINESTRIKETHROUGHSPOILERCUSTOM_EMOJI	ALL_TYPES)NNNN)&__name__
__module____qualname____doc__	__slots__strintr   r
   r   classmethodr   r!   r   r   r$   r   __annotations__r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   listr5   r   __classcell__r   r   r   r   r   !   sN   
:    
 r   N)r9   typingr   r   r   r   Ztelegramr   Ztelegram._telegramobjectr   Ztelegram._userr   Ztelegram._utilsr	   Ztelegram._utils.typesr
   r   r   r   r   r   r   <module>   s   