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
ModmailConversation
instance this message belongs to.
Typical Attributes
This table describes attributes that typically belong to objects of this class. Attributes are dynamically provided by the
aPRAWBase
class and may vary depending on the status of the response and expected objects.Attribute
Description
id
The ID of this message.
body
The HTML body of this message.
body_markdown
The raw body of this message.
body_md
An alias to
body_markdown
.is_internal
Whether the message was sent internally.
date
The 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
ModmailConversation
by 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
aPRAWBase
class and may vary depending on the status of the response and expected objects.Attribute
Description
authors
A list of dictionaries containing authors by name with additional meta information such as
isMod
,isAdmin
,isOp
,isParticipant
,isHidden
,id
,isDeleted
.id
The ID of this conversation.
is_auto
bool
is_highlighted
Whether the conversation has been highlighted.
is_internal
Whether it’s an internal mod conversation.
is_repliable
Whether the conversation can be replied to.
last_mod_update
A timestamp of the last moderator update or
None
.last_unread
None
last_updated
A timestamp of the last update made overall.
last_user_update
A timestamp of the last user update or
None
.num_messages
The number of messages in this conversation.
obj_ids
A list of dictionaries containing the objects with their IDs and keys.
owner
A dictionary describing the subreddit this conversation is held in.
participant
Dict
state
int
subject
The 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