CollectionModeration

class asyncpraw.models.reddit.collections.CollectionModeration(reddit: asyncpraw.Reddit, collection_id: str)

Class to support moderation actions on a Collection.

Obtain an instance via:

subreddit = await reddit.subreddit("test")
collection = await subreddit.collections("some_uuid")
collection.mod
__init__(reddit: asyncpraw.Reddit, collection_id: str)

Initialize a CollectionModeration instance.

Parameters

collection_id – The ID of a Collection.

await add_post(submission: asyncpraw.models.Submission)

Add a post to the collection.

Parameters

submission – The post to add, a Submission, its permalink as a str, its fullname as a str, or its ID as a str.

Example usage:

subreddit = await reddit.subreddit("test")
collection = await subreddit.collections("some_uuid")
await collection.mod.add_post("bgibu9")

See also

remove_post()

await delete()

Delete this collection.

Example usage:

subreddit = await reddit.subreddit("test")
collection = await subreddit.collections("some_uuid")
await collection.mod.delete()

See also

create()

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

Return an instance of cls from data.

Parameters
  • data – The structured data.

  • reddit – An instance of Reddit.

await remove_post(submission: asyncpraw.models.Submission)

Remove a post from the collection.

Parameters

submission – The post to remove, a Submission, its permalink as a str, its fullname as a str, or its ID as a str.

Example usage:

subreddit = await reddit.subreddit("test")
collection = await subreddit.collections("some_uuid")
await collection.mod.remove_post("bgibu9")

See also

add_post()

await reorder(links: List[Union[str, asyncpraw.models.Submission]])

Reorder posts in the collection.

Parameters

links – A list of Submissions or a str that is either a fullname or an ID.

Example usage:

subreddit = await reddit.subreddit("test")
collection = await subreddit.collections("some_uuid")
current_order = collection.link_ids
new_order = reversed(current_order)
await collection.mod.reorder(new_order)
await update_description(description: str)

Update the collection’s description.

Parameters

description – The new description.

Example usage:

subreddit = await reddit.subreddit("test")
collection = await subreddit.collections("some_uuid")
await collection.mod.update_description("Please enjoy these links")

See also

update_title()

await update_display_layout(display_layout: str)

Update the collection’s display layout.

Parameters

display_layout – Either "TIMELINE" for events or discussions or "GALLERY" for images or memes. Passing "" or None will clear the set layout and collection.display_layout will be None, however, the collection will appear on Reddit as if display_layout is set to "TIMELINE".

Example usage:

subreddit = await reddit.subreddit("test")
collection = await subreddit.collections("some_uuid")
await collection.mod.update_display_layout("GALLERY")
await update_title(title: str)

Update the collection’s title.

Parameters

title – The new title.

Example usage:

subreddit = await reddit.subreddit("test")
collection = await subreddit.collections("some_uuid")
await collection.mod.update_title("Titley McTitleface")