Announcement

class asyncpraw.models.Announcement(reddit, id=None, _data=None)

A class that represents a Reddit announcement.

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

body_html

The announcement’s body, rendered as HTML.

body

The announcement’s body, in Markdown.

id

The fullname of the announcement, e.g. 'ann_4sc833'.

permalink

The announcement’s permalink (to view on the web).

read_at

Timestamp the announcement was read, in ISO-8601 format. None if the announcement has not been read.

read_datetime

read_at as a timezone-aware datetime.datetime, or None if the announcement has not been read.

sent_at

Timestamp the announcement was sent, in ISO-8601 format.

sent_datetime

sent_at as a timezone-aware datetime.datetime.

subject

The subject line of the announcement.

Parameters:
__init__(reddit, id=None, _data=None)

Initialize an Announcement instance.

Parameters:
Return type:

None

property fullname: str

Return the object’s fullname.

A fullname is an object’s kind mapping like t3 followed by an underscore and the object’s base36 ID, e.g., t1_c5s96e0.

await hide()

Hide the announcement.

Example usage:

async for announcement in reddit.announcements():
    await announcement.hide()

See also

AnnouncementHelper.hide() to hide multiple announcements at once.

Return type:

None

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 RedditBase object.

await reddit_base_object.load()
Return type:

None

await mark_read()

Mark the announcement as read.

Example usage:

async for announcement in reddit.announcements():
    if announcement.read_at is None:
        await announcement.mark_read()

See also

Return type:

None

classmethod parse(data, reddit)

Return an instance of cls from data.

Parameters:
Return type:

AsyncPRAWBase

property read_datetime: datetime | None

Return the time the announcement was read as a timezone-aware datetime.datetime.

Returns None if the announcement has not been read. The returned object is localized to the system’s timezone.

property sent_datetime: datetime

Return the time the announcement was sent as a timezone-aware datetime.datetime.

The returned object is localized to the system’s timezone.