reddit.live

class asyncpraw.models.DraftHelper(reddit: asyncpraw.Reddit, _data: Optional[Dict[str, Any]])

Provide a set of functions to interact with Draft instances.

Note

The methods provided by this class will only work on the currently authenticated user’s Drafts.

await __call__(*, draft_id: Optional[str] = None, fetch: bool = True) Union[List[asyncpraw.models.Draft], asyncpraw.models.Draft]

Return a list of Draft instances.

Parameters
  • draft_id – When provided, this returns a Draft instance (default: None).

  • fetch – Determines if Async PRAW will fetch the object (default: True).

Returns

A Draft instance if draft_id is provided. Otherwise, a list of Draft objects.

This method can be used to fetch a specific draft by ID, like so:

draft_id = "124862bc-e1e9-11eb-aa4f-e68667a77cbb"
draft = await reddit.drafts(draft_id=draft_id)
print(draft)
__init__(reddit: asyncpraw.Reddit, _data: Optional[Dict[str, Any]])

Initialize a AsyncPRAWBase instance.

Parameters

reddit – An instance of Reddit.

await create(*, flair_id: Optional[str] = None, flair_text: Optional[str] = None, is_public_link: bool = False, nsfw: bool = False, original_content: bool = False, selftext: Optional[str] = None, send_replies: bool = True, spoiler: bool = False, subreddit: Optional[Union[str, asyncpraw.models.Subreddit, asyncpraw.models.UserSubreddit]] = None, title: Optional[str] = None, url: Optional[str] = None, **draft_kwargs) asyncpraw.models.Draft

Create a new Draft.

Parameters
  • flair_id – The flair template to select (default: None).

  • flair_text – If the template’s flair_text_editable value is True, this value will set a custom text (default: None). flair_id is required when flair_text is provided.

  • is_public_link – Whether to enable public viewing of the draft before it is submitted (default: False).

  • nsfw – Whether the draft should be marked NSFW (default: False).

  • original_content – Whether the submission should be marked as original content (default: False).

  • selftext – The Markdown formatted content for a text submission draft. Use None to make a title-only submission draft (default: None). selftext can not be provided if url is provided.

  • send_replies – When True, messages will be sent to the submission author when comments are made to the submission (default: True).

  • spoiler – Whether the submission should be marked as a spoiler (default: False).

  • subreddit – The subreddit to create the draft for. This accepts a subreddit display name, Subreddit object, or UserSubreddit object. If None, the UserSubreddit of currently authenticated user will be used (default: None).

  • title – The title of the draft (default: None).

  • url – The URL for a link submission draft (default: None). url can not be provided if selftext is provided.

Additional keyword arguments can be provided to handle new parameters as Reddit introduces them.

Returns

The new Draft object.

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.