Skip to content
Back to top
View this page

# SubredditCollectionsModeration

class praw.models.reddit.collections.SubredditCollectionsModeration(reddit: praw.Reddit, sub_fullname: str, _data: Dict[str, Any] | None = None)

  Class to represent moderator actions on a `Subreddit`’s `Collection`s.

  Obtain an instance via:

      reddit.subreddit("test").collections.mod

  __init__(reddit: praw.Reddit, sub_fullname: str, _data: Dict[str, Any] | None = None)

    Initialize a `SubredditCollectionsModeration` instance.

  create(*, description: str, display_layout: str | None = None, title: str)

    Create a new `Collection`.

    The authenticated account must have appropriate moderator permissions in the subreddit this collection belongs to.

    Parameters:

      - description – The description, up to 500 characters.

      - display_layout – Either `"TIMELINE"` for events or discussions or `"GALLERY"` for images or memes. Passing `""` or `None` will make the collection appear on Reddit as if this is set to `"TIMELINE"` (default: `None`).

      - title – The title of the collection, up to 300 characters.

    Returns:

      The newly created `Collection`.

    Example usage:

        my_sub = reddit.subreddit("test")
        new_collection = my_sub.collections.mod.create(title="Title", description="desc")
        new_collection.mod.add_post("bgibu9")

    To specify the display layout as `"GALLERY"` when creating the collection:

        my_sub = reddit.subreddit("test")
        new_collection = my_sub.collections.mod.create(
            title="Title", description="desc", display_layout="GALLERY"
        )
        new_collection.mod.add_post("bgibu9")

    See also

    `delete()`

  classmethod parse(data: Dict[str, Any], reddit: praw.Reddit) → Any

    Return an instance of `cls` from `data`.

    Parameters:

      - data – The structured data.

      - reddit – An instance of `Reddit`.