Skip to content
Back to top
View this page

# SubredditModerationStream

class praw.models.reddit.subreddit.SubredditModerationStream(subreddit: praw.models.Subreddit)

  Provides moderator streams.

  __init__(subreddit: praw.models.Subreddit)

    Initialize a `SubredditModerationStream` instance.

    Parameters:

      subreddit – The moderated subreddit associated with the streams.

  edited(*, only: str | None = None, **stream_options: Any) → Generator[praw.models.Comment | praw.models.Submission, None, None]

    Yield edited comments and submissions as they become available.

    Parameters:

      only – If specified, one of `"comments"` or `"submissions"` to yield only results of that type.

    Keyword arguments are passed to `stream_generator()`.

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

        for item in reddit.subreddit("mod").mod.stream.edited():
            print(item)

  log(*, action: str | None = None, mod: praw.models.Redditor | str | None = None, **stream_options: Any) → Generator[praw.models.ModAction, None, None]

    Yield moderator log entries as they become available.

    Parameters:

      - action – If given, only return log entries for the specified action.

      - mod – If given, only return log entries for actions made by the passed in redditor.

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

        for log in reddit.subreddit("mod").mod.stream.log():
            print(f"Mod: {log.mod}, Subreddit: {log.subreddit}")

  modmail_conversations(*, other_subreddits: List[praw.models.Subreddit] | None = None, sort: str | None = None, state: str | None = None, **stream_options: Any) → Generator[ModmailConversation, None, None]

    Yield new-modmail conversations as they become available.

    Parameters:

      - other_subreddits – A list of `Subreddit` instances for which to fetch conversations (default: `None`).

      - sort – Can be one of: `"mod"`, `"recent"`, `"unread"`, or `"user"` (default: `"recent"`).

      - state – 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.

    Keyword arguments are passed to `stream_generator()`.

    To print new mail in the unread modmail queue try:

        subreddit = reddit.subreddit("all")
        for message in subreddit.mod.stream.modmail_conversations():
            print(f"From: {message.owner}, To: {message.participant}")

  modqueue(*, only: str | None = None, **stream_options: Any) → Generator[praw.models.Comment | praw.models.Submission, None, None]

    Yield `Comment`s and `Submission`s in the modqueue as they become available.

    Parameters:

      only – If specified, one of `"comments"` or `"submissions"` to yield only results of that type.

    Keyword arguments are passed to `stream_generator()`.

    To print all new modqueue items try:

        for item in reddit.subreddit("mod").mod.stream.modqueue():
            print(item)

  reports(*, only: str | None = None, **stream_options: Any) → Generator[praw.models.Comment | praw.models.Submission, None, None]

    Yield reported `Comment`s and `Submission`s as they become available.

    Parameters:

      only – If specified, one of `"comments"` or `"submissions"` to yield only results of that type.

    Keyword arguments are passed to `stream_generator()`.

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

        for item in reddit.subreddit("mod").mod.stream.reports():
            print(item)

  spam(*, only: str | None = None, **stream_options: Any) → Generator[praw.models.Comment | praw.models.Submission, None, None]

    Yield spam `Comment`s and `Submission`s as they become available.

    Parameters:

      only – If specified, one of `"comments"` or `"submissions"` to yield only results of that type.

    Keyword arguments are passed to `stream_generator()`.

    To print new items in the spam queue try:

        for item in reddit.subreddit("mod").mod.stream.spam():
            print(item)

  unmoderated(**stream_options: Any) → Generator[praw.models.Submission, None, None]

    Yield unmoderated `Submission`s as they become available.

    Keyword arguments are passed to `stream_generator()`.

    To print new items in the unmoderated queue try:

        for item in reddit.subreddit("mod").mod.stream.unmoderated():
            print(item)

  unread(**stream_options: Any) → Generator[praw.models.SubredditMessage, None, None]

    Yield unread old modmail messages as they become available.

    Keyword arguments are passed to `stream_generator()`.

    See also

    `SubredditModeration.inbox()` for all messages.

    To print new mail in the unread modmail queue try:

        for message in reddit.subreddit("mod").mod.stream.unread():
            print(f"From: {message.author}, To: {message.dest}")