Subreddit Modmail¶
This section details the usage of models related to subreddit modmail.
ModmailMessage¶
- class apraw.models.ModmailMessage(reddit: Reddit, data: Dict, conversation: apraw.models.subreddit.modmail.ModmailConversation)¶
The model for modmail messages.
- conversation: ModmailConversation
The
ModmailConversationinstance this message belongs to.
Typical Attributes
This table describes attributes that typically belong to objects of this class. Attributes are dynamically provided by the
aPRAWBaseclass and may vary depending on the status of the response and expected objects.Attribute
Description
idThe ID of this message.
bodyThe HTML body of this message.
body_markdownThe raw body of this message.
body_mdAn alias to
body_markdown.is_internalWhether the message was sent internally.
dateThe datetime string on which the message was sent.
SubredditModmail¶
- class apraw.models.SubredditModmail(reddit: Reddit, subreddit: Subreddit)¶
Helper class to aid in retrieving subreddit modmail.
- async __call__(id: str, mark_read=False) apraw.models.subreddit.modmail.ModmailConversation¶
Fetch a
ModmailConversationby its ID.- Parameters
id (str) – The conversation’s ID.
- Returns
conversation – The conversation requested if it exists.
- Return type
- conversations() apraw.models.subreddit.modmail.ModmailConversation¶
Retrieve a list of modmail conversations.
- Yields
conversation (ModmailConversation) – A modmail conversation held in the subreddit.
ModmailConversation¶
- class apraw.models.ModmailConversation(reddit: Reddit, data: Dict, owner: Subreddit = None)¶
The model for modmail conversations.
Typical Attributes
This table describes attributes that typically belong to objects of this class. Attributes are dynamically provided by the
aPRAWBaseclass and may vary depending on the status of the response and expected objects.Attribute
Description
authorsA list of dictionaries containing authors by name with additional meta information such as
isMod,isAdmin,isOp,isParticipant,isHidden,id,isDeleted.idThe ID of this conversation.
is_autoboolis_highlightedWhether the conversation has been highlighted.
is_internalWhether it’s an internal mod conversation.
is_repliableWhether the conversation can be replied to.
last_mod_updateA timestamp of the last moderator update or
None.last_unreadNonelast_updatedA timestamp of the last update made overall.
last_user_updateA timestamp of the last user update or
None.num_messagesThe number of messages in this conversation.
obj_idsA list of dictionaries containing the objects with their IDs and keys.
ownerA dictionary describing the subreddit this conversation is held in.
participantDictstateintsubjectThe subject of this conversation.
- async archive()¶
Archive the modmail conversation.
- Returns
self – The updated model.
- Return type
- async fetch(mark_read=False)¶
Fetch this item’s information from a suitable API endpoint.
- Returns
self – The updated model.
- Return type
- async highlight()¶
Highlight the modmail conversation.
- Returns
self – The updated model.
- Return type
- messages() apraw.models.subreddit.modmail.ModmailMessage¶
Retrieve the messages sent in this conversation.
- Yields
message (ModmailMessage) – A message sent in this conversation.
- async mute()¶
Mute the modmail conversation.
- Returns
self – The updated model.
- Return type
- async owner() Subreddit¶
Retrieve the owner subreddit of this conversation.
- Returns
owner – The subreddit this conversation was held in.
- Return type
- async remove_highlight()¶
Remove the highlight from the modmail conversation.
- Returns
self – The updated model.
- Return type
- async reply(body: str, author_hidden: bool = False, internal: bool = False)¶
Reply to the modmail conversation.
- Parameters
body (str) – The markdown reply body.
author_hidden (bool) – Whether the author of this reply should be hidden.
internal (bool) – Whether the reply is internal.
- Returns
self – The updated model.
- Return type
- async unarchive()¶
Unarchive the modmail conversation.
- Returns
self – The updated model.
- Return type
- async unmute()¶
Unmute the modmail conversation.
- Returns
self – The updated model.
- Return type