ModmailConversation¶
-
class
praw.models.ModmailConversation(reddit: Reddit, id: Optional[str] = None, mark_read: bool = False, _data: Optional[Dict[str, Any]] = None)¶ A class for modmail conversations.
Typical Attributes
This table describes attributes that typically belong to objects of this class. Since attributes are dynamically provided (see Determine Available Attributes of an Object), there is not a guarantee that these attributes will always be present, nor is this list necessarily complete.
Attribute
Description
authorsProvides an ordered list of
Redditorinstances. The authors of each message in the modmail conversation.idThe ID of the ModmailConversation.
is_highlightedWhether or not the ModmailConversation is highlighted.
is_internalWhether or not the ModmailConversation is a private mod conversation.
last_mod_updateTime of the last mod message reply, represented in the ISO 8601 standard with timezone.
last_updatedTime of the last message reply, represented in the ISO 8601 standard with timezone.
last_user_updateTime of the last user message reply, represented in the ISO 8601 standard with timezone.
num_messagesThe number of messages in the ModmailConversation.
obj_idsProvides a list of dictionaries representing mod actions on the ModmailConversation. Each dict contains attributes of “key” and “id”. The key can be either “messages” or “ModAction”. ModAction represents archiving/highlighting etc.
ownerProvides an instance of
Subreddit. The subreddit that the ModmailConversation belongs to.participantProvides an instance of
Redditor. The participating user in the ModmailConversation.subjectThe subject of the ModmailConversation.
-
__init__(reddit: Reddit, id: Optional[str] = None, mark_read: bool = False, _data: Optional[Dict[str, Any]] = None)¶ Construct an instance of the ModmailConversation object.
- Parameters
mark_read – If True, conversation is marked as read (default: False).
-
archive()¶ Archive the conversation.
For example:
reddit.subreddit("redditdev").modmail("2gmz").archive()
-
highlight()¶ Highlight the conversation.
For example:
reddit.subreddit("redditdev").modmail("2gmz").highlight()
-
mute(num_days=3)¶ Mute the non-mod user associated with the conversation.
- Parameters
num_days – Duration of mute in days. Valid options are 3, 7, or 28. (default: 3)
For example:
reddit.subreddit("redditdev").modmail("2gmz").mute()
To mute for 7 days:
reddit.subreddit("redditdev").modmail("2gmz").mute(7)
-
classmethod
parse(data: Dict[str, Any], reddit: Reddit, convert_objects: bool = True)¶ Return an instance of ModmailConversation from
data.- Parameters
data – The structured data.
reddit – An instance of
Reddit.convert_objects – If True, convert message and mod action data into objects (default: True).
-
read(other_conversations: Optional[List[praw.models.reddit.modmail.ModmailConversation]] = None)¶ Mark the conversation(s) as read.
- Parameters
other_conversations – A list of other conversations to mark (default: None).
For example, to mark the conversation as read along with other recent conversations from the same user:
subreddit = reddit.subreddit("redditdev") conversation = subreddit.modmail.conversation("2gmz") conversation.read(other_conversations=conversation.user.recent_convos)
-
reply(body: str, author_hidden: bool = False, internal: bool = False)¶ Reply to the conversation.
- Parameters
body – The Markdown formatted content for a message.
author_hidden – When True, author is hidden from non-moderators (default: False).
internal – When True, message is a private moderator note, hidden from non-moderators (default: False).
- Returns
A
ModmailMessageobject for the newly created message.
For example, to reply to the non-mod user while hiding your username:
conversation = reddit.subreddit("redditdev").modmail("2gmz") conversation.reply("Message body", author_hidden=True)
To create a private moderator note on the conversation:
conversation.reply("Message body", internal=True)
-
unarchive()¶ Unarchive the conversation.
For example:
reddit.subreddit("redditdev").modmail("2gmz").unarchive()
-
unhighlight()¶ Un-highlight the conversation.
For example:
reddit.subreddit("redditdev").modmail("2gmz").unhighlight()
-
unmute()¶ Unmute the non-mod user associated with the conversation.
For example:
reddit.subreddit("redditdev").modmail("2gmz").unmute()
-
unread(other_conversations: Optional[List[praw.models.reddit.modmail.ModmailConversation]] = None)¶ Mark the conversation(s) as unread.
- Parameters
other_conversations – A list of other conversations to mark (default: None).
For example, to mark the conversation as unread along with other recent conversations from the same user:
subreddit = reddit.subreddit("redditdev") conversation = subreddit.modmail.conversation("2gmz") conversation.unread(other_conversations=conversation.user.recent_convos)
-