Ë
    Fü´jô  ã            	      ó¸   — d 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mZmZmZ ddlmZ ddlmZ er
dd	lZdd
lmZ  G d„ deeeee	«      Z G d„ de«      Zy	)zProvide the Message class.é    )Úannotations)ÚTYPE_CHECKINGÚAny)ÚAPI_PATH)Ú
RedditBase)ÚCreatedMixinÚFullnameMixinÚInboxableMixinÚReplyableMixin)ÚRedditor)Ú	SubredditN)Úmodelsc                  óŒ   ‡ — e Zd ZdZdZed	d„«       Zed
d„«       Zedd„«       Z	e	j                  dd„«       Z	dˆ fd„Zdd„Zˆ xZS )ÚMessagea  A class for private messages.

    .. include:: ../../typical_attributes.rst

    =============== ================================================================
    Attribute       Description
    =============== ================================================================
    ``author``      Provides an instance of :class:`.Redditor`.
    ``body``        The body of the message, as Markdown.
    ``body_html``   The body of the message, as HTML.
    ``created_utc`` Time the message was created, represented in `Unix Time`_.
    ``dest``        Provides an instance of :class:`.Redditor`. The recipient of the
                    message.
    ``id``          The ID of the message.
    ``name``        The full ID of the message, prefixed with ``t4_``.
    ``subject``     The subject of the message.
    ``was_comment`` Whether or not the message was a comment reply.
    =============== ================================================================

    .. _unix time: https://en.wikipedia.org/wiki/Unix_time

    Úidc                ón  — |d   rt        ||d   «      |d<   |d   j                  d«      rt        ||d   dd «      |d<   nt        ||d   «      |d<   |d   r+|d   }|j                  j	                  |d   d   ¬	«      |d<   ng |d<   |d
   rt        ||d
   «      |d
<   t        ||¬«      S  | ||¬«      S )zÁReturn an instance of :class:`.Message` or :class:`.SubredditMessage` from ``data``.

        :param data: The structured data.
        :param reddit: An instance of :class:`.Reddit`.

        ÚauthorÚdestú#é   NÚrepliesÚdataÚchildren©r   Ú	subreddit)Ú_data)r   Ú
startswithr   Ú	_objectorÚ	objectifyÚSubredditMessage)Úclsr   Úredditr   s       úX/root/workspace/ytshorts/venv/lib/python3.12/site-packages/praw/models/reddit/message.pyÚparsezMessage.parse,   s×   € ð �Š>Ü% f¨d°8©nÓ=ˆD�‰Nà�‰<×"Ñ" 3Ô'Ü$ V¨T°&©\¸!¸"Ð-=Ó>ˆD�ŠLä# F¨D°©LÓ9ˆD�‰Là�	Š?Ø˜9‘oˆGØ$×.Ñ.×8Ñ8¸gÀf¹oÈjÑ>YÐ8ÓZˆD�ŠOà ˆD�‰Oà�ÒÜ )¨&°$°{Ñ2CÓ DˆD�ÑÜ# F°$Ô7Ð7á�6 Ô&Ð&ó    c                óH   — | j                   j                  j                  d   S )zThe class's kind.Úmessage)Ú_redditÚconfigÚkinds©Úselfs    r#   Ú_kindzMessage._kindH   s   € ð �|‰|×"Ñ"×(Ñ(¨Ñ3Ð3r%   c                óÖ   — | j                   sR| j                  rF| j                  j                  j	                  | j                  j                  d«      d   «      | _         | j                   S )z'The parent of the message if it exists.Ú_r   )Ú_parentÚ	parent_idr(   Úinboxr'   Úsplitr+   s    r#   ÚparentzMessage.parentM   sL   € ð �|Š| §¢ØŸ<™<×-Ñ-×5Ñ5°d·n±n×6JÑ6JÈ3Ó6OÐPQÑ6RÓSˆDŒLØ�|‰|Ðr%   c                ó   — || _         y )N)r0   )r,   Úvalues     r#   r4   zMessage.parentT   s	   € àˆ�r%   c                ó¨   •— t         ‰| �  ||d¬«       d| _        |j                  dg «      D ]#  }|j                  | j
                  k(  sŒ| |_        Œ% y)z(Initialize a :class:`.Message` instance.T)r   Ú_fetchedNr   )ÚsuperÚ__init__r0   Úgetr1   Úfullnamer4   )r,   r"   r   ÚreplyÚ	__class__s       €r#   r:   zMessage.__init__X   sO   ø€ ä‰Ñ˜ u°tÐÔ<ØˆŒØ—Y‘Y˜y¨"Ó-ò 	$ˆEØ�‰ $§-¡-Ó/Ø#�•ñ	$r%   c                ód   — | j                   j                  t        d   d| j                  i¬«       y)a<  Delete the message.

        .. note::

            Reddit does not return an indication of whether or not the message was
            successfully deleted.

        For example, to delete the most recent message in your inbox:

        .. code-block:: python

            next(reddit.inbox.all()).delete()

        Údelete_messager   r   N)r(   Úpostr   r<   r+   s    r#   ÚdeletezMessage.delete`   s*   € ð 	�‰×Ñœ(Ð#3Ñ4¸DÀ$Ç-Á-Ð;PÐÕQr%   )r   údict[str, Any]r"   úpraw.RedditÚreturnzMessage | SubredditMessage)rE   Ústr)rE   úmodels.Message | None)r6   rG   rE   ÚNone)r"   rD   r   rC   rE   rH   )rE   rH   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	STR_FIELDÚclassmethodr$   Úpropertyr-   r4   Úsetterr:   rB   Ú__classcell__)r>   s   @r#   r   r      sl   ø„ ñð. €Iàò'ó ð'ð6 ò4ó ð4ð òó ðð ‡]�]òó ðõ$÷Rr%   r   c                  ó   — e Zd ZdZy)r    aŽ  A class for messages to a subreddit.

    .. include:: ../../typical_attributes.rst

    =============== =================================================================
    Attribute       Description
    =============== =================================================================
    ``author``      Provides an instance of :class:`.Redditor`.
    ``body``        The body of the message, as Markdown.
    ``body_html``   The body of the message, as HTML.
    ``created_utc`` Time the message was created, represented in `Unix Time`_.
    ``dest``        Provides an instance of :class:`.Redditor`. The recipient of the
                    message.
    ``id``          The ID of the message.
    ``name``        The full ID of the message, prefixed with ``t4_``.
    ``subject``     The subject of the message.
    ``subreddit``   If the message was sent from a subreddit, provides an instance of
                    :class:`.Subreddit`.
    ``was_comment`` Whether or not the message was a comment reply.
    =============== =================================================================

    .. _unix time: https://en.wikipedia.org/wiki/Unix_time

    N)rI   rJ   rK   rL   © r%   r#   r    r    r   s   „ òr%   r    )rL   Ú
__future__r   Útypingr   r   Ú
praw.constr   Úpraw.models.reddit.baser   Úpraw.models.reddit.mixinsr   r	   r
   r   Úpraw.models.reddit.redditorr   Úpraw.models.reddit.subredditr   Úprawr   r   r    rS   r%   r#   ú<module>r\      sN   ðÙ  å "ç %å Ý .ß aÓ aÝ 0Ý 2áÛÝô]Rˆn˜n¨m¸\È:ô ]Rô@�wõ r%   