Message

This section describes the usage and members of the Message model.

Messages are the private messages sent and received via the old Reddit private messaging system and are conventionally retrieved through the inbox:

async for message in reddit.user.inbox.unread():
    print(message)
class apraw.models.Message(reddit: Reddit, data: Dict[str, Any])

The model representing comments.

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

first_message

The first message sent in the message thread if the current message wasn’t the first.

first_message_name

The fullname of the first message in the message thread if applicable.

subreddit

The subreddit this conversation is being held in if applicable.

likes

None

replies

A list of all the message replies if applicable, otherwise an empty string.

id

The message ID.

subject

The subject of this message’s thread.

associated_awarding_id

The ID of the associated awarding if the message was sent in the context of an award.

score

0

author

The username of the message’s author.

num_comments

The number of comments in this message’s thread.

parent_id

None

subreddit_name_prefixed

The prefixed name of the subreddit this conversation is being held in if applicable.

new

bool

type

str

body

The markdown string contents of this message.

dest

The recipient of the message.

body_html

The HTML string contents of this message.

was_comment

Whether this message was a comment.

name

The fullname of this message, representing the ID prefixed with its kind. (e.g. t4_)

created

The timestamp on which this message was created.

created_utc

The parsed UTC datetime on which this message was created.

context

str

distinguished

The type of distinguishment on this message object.

async author() apraw.models.reddit.redditor.Redditor

Retrieve the item’s author as a Redditor.

Returns

author – The item’s author.

Return type

Redditor

async comment(text: str) Union[Comment, Message]

Reply to the item.

Returns

reply – The newly created reply, either a Comment or Message.

Return type

Comment or Message

async fetch()

Fetch this item’s information from a suitable API endpoint.

Returns

self – The updated model.

Return type

aPRAWBase

property fullname

Get the ID prepended with its kind.

Returns

fullname – The item’s ID prepended with its kind such as t1_.

Return type

str

async reply(text: str) Union[Comment, Message]

Reply to the item.

Returns

reply – The newly created reply, either a Comment or Message.

Return type

Comment or Message

async subreddit() Subreddit

Retrieve the subreddit this item was made in as a Subreddit.

Returns

subreddit – The subreddit this item was made in.

Return type

Subreddit