ModmailConversation¶
- class asyncpraw.models.reddit.modmail.ModmailConversation(reddit, id=None, *, mark_read=False, _data=None)¶
A class for modmail conversations.
Typical Attributes
Note
This table describes attributes that typically belong to objects of this class. Async PRAW dynamically provides the attributes that Reddit returns via the API. Since those attributes are subject to change on Reddit’s end, Async PRAW makes no effort to document any new/removed/changed attributes, other than to instruct you on how to discover what is available. As a result, this table of attributes may not be complete. See Determine Available Attributes of an Object for detailed information.
If you would like to add an attribute to this table, feel free to open a pull request.
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
ModmailConversationis highlighted.is_internalWhether or not the
ModmailConversationis 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 theModmailConversationbelongs to.participantProvides an instance of
Redditor. The participating user in theModmailConversation.subjectThe subject of the
ModmailConversation.- Parameters:
reddit (asyncpraw.Reddit)
id (str | None)
mark_read (bool)
- __init__(reddit, id=None, *, mark_read=False, _data=None)¶
Initialize a
ModmailConversationinstance.
- await archive()¶
Archive the conversation.
For example:
subreddit = await reddit.subreddit("test") conversation = await subreddit.modmail("2gmz") await conversation.archive()
- Return type:
- await highlight()¶
Highlight the conversation.
For example:
subreddit = await reddit.subreddit("test") conversation = await subreddit.modmail("2gmz") await conversation.highlight()
- Return type:
- await load()¶
Re-fetches the object.
This is used to explicitly fetch or re-fetch the object from reddit. This method can be used on any
RedditBaseobject.await reddit_base_object.load()
- Return type:
- await mute(*, num_days=3)¶
Mute the non-mod user associated with the conversation.
- Parameters:
num_days (
int) – Duration of mute in days. Valid options are3,7, or28(default:3).- Return type:
For example:
subreddit = await reddit.subreddit("test") conversation = await subreddit.modmail("2gmz") await conversation.mute()
To mute for 7 days:
subreddit = await reddit.subreddit("test") conversation = await subreddit.modmail("2gmz") await conversation.mute(num_days=7)
- classmethod parse(data, reddit)¶
Return an instance of
ModmailConversationfromdata.
- await read(*, other_conversations=None)¶
Mark the conversation(s) as read.
- Parameters:
other_conversations (
list[ModmailConversation] |None) – A list of other conversations to mark (default:None).- Return type:
For example, to mark the conversation as read along with other recent conversations from the same user:
subreddit = await reddit.subreddit("test") conversation = await subreddit.modmail.conversation("2gmz") await conversation.read(other_conversations=conversation.user.recent_convos)
- await reply(*, author_hidden=False, body, internal=False)¶
Reply to the conversation.
- Parameters:
- Return type:
- Returns:
A
ModmailMessageobject for the newly created message.
For example, to reply to the non-mod user while hiding your username:
subreddit = await reddit.subreddit("test") conversation = await subreddit.modmail("2gmz") await conversation.reply(body="Message body", author_hidden=True)
To create a private moderator note on the conversation:
await conversation.reply(body="Message body", internal=True)
- await unarchive()¶
Unarchive the conversation.
For example:
subreddit = await reddit.subreddit("test") conversation = await subreddit.modmail("2gmz") await conversation.unarchive()
- Return type:
- await unhighlight()¶
Un-highlight the conversation.
For example:
subreddit = await reddit.subreddit("test") conversation = await subreddit.modmail("2gmz") await conversation.unhighlight()
- Return type:
- await unmute()¶
Unmute the non-mod user associated with the conversation.
For example:
subreddit = await reddit.subreddit("test") conversation = await subreddit.modmail("2gmz") await conversation.unmute()
- Return type:
- await unread(*, other_conversations=None)¶
Mark the conversation(s) as unread.
- Parameters:
other_conversations (
list[ModmailConversation] |None) – A list of other conversations to mark (default:None).- Return type:
For example, to mark the conversation as unread along with other recent conversations from the same user:
subreddit = await reddit.subreddit("test") conversation = await subreddit.modmail.conversation("2gmz") await conversation.unread(other_conversations=conversation.user.recent_convos)