SubredditCollectionsModeration
- class asyncpraw.models.reddit.collections.SubredditCollectionsModeration(reddit: asyncpraw.Reddit, subreddit: asyncpraw.models.Subreddit, _data: Optional[Dict[str, Any]] = None)
Class to represent moderator actions on a
Subreddit
’sCollection
s.Obtain an instance via:
subreddit = await reddit.subreddit("test") subreddit.collections.mod
- __init__(reddit: asyncpraw.Reddit, subreddit: asyncpraw.models.Subreddit, _data: Optional[Dict[str, Any]] = None)
Initialize a
SubredditCollectionsModeration
instance.
- await create(*, description: str, display_layout: Optional[str] = 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""
orNone
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:
sub = await reddit.subreddit("test") new_collection = await sub.collections.mod.create(title="Title", description="desc") await new_collection.mod.add_post("bgibu9")
To specify the display layout as
"GALLERY"
when creating the collection:my_sub = await reddit.subreddit("test") new_collection = await my_sub.collections.mod.create( title="Title", description="desc", display_layout="GALLERY" ) await new_collection.mod.add_post("bgibu9")
See also