
    {i                        S r SSKJr  SSKJrJr  SSKJr  SSKJ	r	  SSK
JrJrJr  SS	KJr  SS
KJr  \(       a  SSKr " S S\\\\	5      r " S S\5      rg)zProvide the Message class.    )annotations)TYPE_CHECKINGAny   )API_PATH   )
RedditBase)FullnameMixinInboxableMixinReplyableMixin)Redditor)	SubredditNc                     ^  \ rS rSrSrSr\      SS j5       r\SS j5       r	\SS j5       r
\
R                  SS j5       r
SU 4S jjrS	 rS
rU =r$ )Message   a  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                |   US   (       a  [        X!S   5      US'   US   R                  S5      (       a  [        X!S   SS 5      US'   O[        X!S   5      US'   US   (       a*  US   nUR                  R	                  US   S   5      US'   O/ US'   US	   (       a  [        X!S	   5      US	'   [        X!S
9$ U " X!S
9$ )zReturn an instance of :class:`.Message` or :class:`.SubredditMessage` from ``data``.

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

authordest#r   Nrepliesdatachildren	subreddit)_data)r   
startswithr   	_objector	objectifySubredditMessage)clsr   redditr   s       T/home/james-whalen/.local/lib/python3.13/site-packages/praw/models/reddit/message.pyparseMessage.parse+   s     >%f8n=DN<""3''$V&\!"-=>DL#FL9DL	?9oG$..889TUDO DO )&{2C DD#F776&&    c                H    U R                   R                  R                  S   $ )zReturn the class's kind.message)_redditconfigkindsselfs    r"   _kindMessage._kindI   s     ||""((33r%   c                    U R                   (       dW  U R                  (       aF  U R                  R                  R	                  U R                  R                  S5      S   5      U l         U R                   $ )z.Return the parent of the message if it exists._r   )_parent	parent_idr(   inboxr'   splitr+   s    r"   parentMessage.parentN   sL     ||<<--55dnn6J6J36OPQ6RSDL||r%   c                    Xl         g )Nr1   )r,   values     r"   r5   r6   U   s    r%   c                   > [         TU ]  XSS9  SU l        UR                  S/ 5       H%  nUR                  U R
                  :X  d  M  Xl        M'     g)z(Initialize a :class:`.Message` instance.T)r   _fetchedNr   )super__init__r1   getr2   fullnamer5   )r,   r!   r   reply	__class__s       r"   r=   Message.__init__Y   sF    t<YYy"-E$--/# .r%   c                ^    U R                   R                  [        S   SU R                  0S9  g)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"   deleteMessage.deletea   s*     	(#34D$--;PQr%   r8   )r   dict[str, Any]r!   praw.RedditreturnzMessage | SubredditMessage)rL   str)rL   praw.models.Message | None)r9   rN   )r!   rK   r   rJ   )__name__
__module____qualname____firstlineno____doc__	STR_FIELDclassmethodr#   propertyr-   r5   setterr=   rH   __static_attributes____classcell__)rA   s   @r"   r   r      s    . I'!'+6'	#' ': 4 4   ]] $R Rr%   r   c                  $    \ rS rSrSrS rS rSrg)r   s   aB  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

c                ^    U R                   R                  [        S   SU R                  0S9  g)ah  Mute the sender of this :class:`.SubredditMessage`.

For example, to mute the sender of the first :class:`.SubredditMessage` in the
authenticated users' inbox:

.. code-block:: python

    from praw.models import SubredditMessage

    msg = next(
        message for message in reddit.inbox.all() if isinstance(message, SubredditMessage)
    )
    msg.mute()

mute_senderr   rE   NrF   r+   s    r"   muteSubredditMessage.mute   s)      	(=1t}}8MNr%   c                ^    U R                   R                  [        S   SU R                  0S9  g)an  Unmute the sender of this :class:`.SubredditMessage`.

For example, to unmute the sender of the first :class:`.SubredditMessage` in the
authenticated users' inbox:

.. code-block:: python

    from praw.models import SubredditMessage

    msg = next(
        message for message in reddit.inbox.all() if isinstance(message, SubredditMessage)
    )
    msg.unmute()

unmute_senderr   rE   NrF   r+   s    r"   unmuteSubredditMessage.unmute   s)      	(?34:OPr%    N)rO   rP   rQ   rR   rS   r^   rb   rX   rd   r%   r"   r   r   s   s    2O$Qr%   r   )rS   
__future__r   typingr   r   constr   baser	   mixinsr
   r   r   redditorr   r   r   praw.modelsprawr   r   rd   r%   r"   <module>rm      sK      " %   A A   _RnnmZ _RD<Qw <Qr%   