SubredditModerationStream

class asyncpraw.models.reddit.subreddit.SubredditModerationStream(subreddit)

Provides moderator streams.

Parameters:

subreddit (asyncpraw.models.Subreddit)

__init__(subreddit)

Initialize a SubredditModerationStream instance.

Parameters:

subreddit (Subreddit) – The moderated subreddit associated with the streams.

Return type:

None

edited(*, only=None, **stream_options)

Yield edited comments and submissions as they become available.

Parameters:
  • only (str | None) – If specified, one of "comments" or "submissions" to yield only results of that type.

  • stream_options (Any)

Return type:

AsyncIterator[Comment | Submission]

Keyword arguments are passed to stream_generator().

For example, to retrieve all new edited submissions/comments made to all moderated subreddits, try:

subreddit = await reddit.subreddit("mod")
async for item in subreddit.mod.stream.edited():
    print(item)
log(*, action=None, mod=None, **stream_options)

Yield moderator log entries as they become available.

Parameters:
  • action (str | None) – If given, only return log entries for the specified action.

  • mod (str | Redditor | None) – If given, only return log entries for actions made by the passed in redditor.

  • stream_options (Any)

Return type:

AsyncIterator[ModAction]

For example, to retrieve all new mod actions made to all moderated subreddits, try:

subreddit = await reddit.subreddit("mod")
async for log in subreddit.mod.stream.log():
    print("Mod: {}, Subreddit: {}".format(log.mod, log.subreddit))
modmail_conversations(*, other_subreddits=None, sort=None, state=None, **stream_options)

Yield new-modmail conversations as they become available.

Parameters:
  • other_subreddits (list[Subreddit] | None) – A list of Subreddit instances for which to fetch conversations (default: None).

  • sort (str | None) – Can be one of: "mod", "recent", "unread", or "user" (default: "recent").

  • state (str | None) – Can be one of: "all", "appeals", "archived", "default", "highlighted", "inbox", "inprogress", "join_requests", "mod", "new", or "notifications" (default: "all"). "all" does not include mod or archived conversations. "inbox" does not include appeals conversations.

  • stream_options (Any)

Return type:

AsyncIterator[ModmailConversation]

Keyword arguments are passed to stream_generator().

To print new mail in the unread modmail queue try:

subreddit = await reddit.subreddit("all")
async for message in subreddit.mod.stream.modmail_conversations():
    print(f"From: {message.owner}, To: {message.participant}")
modqueue(*, only=None, **stream_options)

Yield Comments and Submissions in the modqueue as they become available.

Parameters:
  • only (str | None) – If specified, one of "comments" or "submissions" to yield only results of that type.

  • stream_options (Any)

Return type:

AsyncIterator[Comment | Submission]

Keyword arguments are passed to stream_generator().

To print all new modqueue items try:

subreddit = await reddit.subreddit("mod")
async for item in subreddit.mod.stream.modqueue():
    print(item)
reports(*, only=None, **stream_options)

Yield reported Comments and Submissions as they become available.

Parameters:
  • only (str | None) – If specified, one of "comments" or "submissions" to yield only results of that type.

  • stream_options (Any)

Return type:

AsyncIterator[Comment | Submission]

Keyword arguments are passed to stream_generator().

To print new user and mod report reasons in the report queue try:

subreddit = await reddit.subreddit("mod")
async for item in subreddit.mod.stream.reports():
    print(item)
spam(*, only=None, **stream_options)

Yield spam Comments and Submissions as they become available.

Parameters:
  • only (str | None) – If specified, one of "comments" or "submissions" to yield only results of that type.

  • stream_options (Any)

Return type:

AsyncIterator[Comment | Submission]

Keyword arguments are passed to stream_generator().

To print new items in the spam queue try:

subreddit = await reddit.subreddit("mod")
async for item in subreddit.mod.stream.spam():
    print(item)
unmoderated(**stream_options)

Yield unmoderated Submissions as they become available.

Keyword arguments are passed to stream_generator().

To print new items in the unmoderated queue try:

subreddit = await reddit.subreddit("mod")
async for item in subreddit.mod.stream.unmoderated():
    print(item)
Return type:

AsyncIterator[Submission]

Parameters:

stream_options (Any)