o
    2g                     @  sR   d Z ddlmZ ddlmZ ddlmZ ddlmZ er ddl	Z	G dd	 d	Z
dS )
z#Provide the MessageableMixin class.    )annotations)TYPE_CHECKING   )API_PATH)_deprecate_argsNc                   @  s,   e Zd ZdZeddddddd	d
ZdS )MessageableMixinz+Interface for classes that can be messaged.subjectmessagefrom_subredditN)r
   "praw.models.Subreddit | str | Nonestrc                C  sF   ||t | jdd |  d}|rt||d< | jjtd |d dS )a  Send a message to a :class:`.Redditor` or a :class:`.Subreddit`'s moderators (modmail).

        :param from_subreddit: A :class:`.Subreddit` instance or string to send the
            message from. When provided, messages are sent from the subreddit rather
            than from the authenticated user.

            .. note::

                The authenticated user must be a moderator of the subreddit and have the
                ``mail`` moderator permission.

        :param message: The message content.
        :param subject: The subject of the message.

        For example, to send a private message to u/spez, try:

        .. code-block:: python

            reddit.redditor("spez").message(subject="TEST", message="test message from PRAW")

        To send a message to u/spez from the moderators of r/test try:

        .. code-block:: python

            reddit.redditor("spez").message(
                subject="TEST", message="test message from r/test", from_subreddit="test"
            )

        To send a message to the moderators of r/test, try:

        .. code-block:: python

            reddit.subreddit("test").message(subject="TEST", message="test PM from PRAW")

        MESSAGE_PREFIX )r   texttofrom_srcompose)dataN)getattr	__class__r   _redditpostr   )selfr
   r	   r   r    r   ]/home/garg/my-data/venv/lib/python3.10/site-packages/praw/models/reddit/mixins/messageable.pyr	      s   ,zMessageableMixin.message)r
   r   r	   r   r   r   )__name__
__module____qualname____doc__r   r	   r   r   r   r   r      s
    
r   )r   
__future__r   typingr   constr   utilr   prawr   r   r   r   r   <module>   s    