redditwarp.siteprocs.comment.ASYNC
#
- class redditwarp.siteprocs.comment.ASYNC.CommentProcedures(client: Client)[source]#
Bases:
object
- fetch: Fetch#
Fetch a comment.
- Parameters:
idy (int | str) – Comment ID.
- Return type:
- Raises:
redditwarp.exceptions.NoResultException – The target was not found.
- bulk_fetch(ids: Iterable[_YIntOrStr]) CallChunkChainingAsyncIterator[Comment] [source]#
Bulk fetch comments.
Any ID not found will be ignored.
- Parameters:
ids (Iterable[_YIntOrStr]) – Comment IDs.
- Return type:
- async reply(idy: int | str, body: str | Mapping[str, JSON_ro]) Comment [source]#
Reply to a comment.
- Parameters:
idy (Union[int, str]) –
body (
Union
[str
,Mapping
[str
,JSON_ro
]]) – Either markdown or richtext.
- Return type:
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
RATELIMIT
:Content creation cooldown.
NO_TEXT
:The specified
body
was empty.
TOO_OLD
:The subreddit has archiving enabled and the target comment is archived (older than 6 months).
THREAD_LOCKED
:The target comment submission is locked and you are not a moderator of the subreddit.
DELETED_COMMENT
:The target comment was deleted.
SOMETHING_IS_BROKEN
:The author of the target comment has blocked you.
USER_BLOCKED
:The author of the target comment is a user you have blocked.
SUBREDDIT_OUTBOUND_LINKING_DISALLOWED
:Some subreddits prevent you from linking to other subreddits. E.g., writing ‘r/funny’ in ‘r/formuladank’. It is not known what setting controls this.
SUBREDDIT_LINKING_DISALLOWED
:Some subreddits cannot be linked to at all. E.g., ‘r/chonglangTV’. It is unknown why.
redditwarp.http.exceptions.StatusCodeException –
403
:The target comment does not exist.
500
:The target comment is from a quarantined subreddit that the current user has not opted in to.
- async edit_body(idy: int | str, body: str | Mapping[str, JSON_ro]) Comment [source]#
Edit the body text of a comment.
The target entity (with the new body text) is returned.
- Parameters:
idy (Union[int, str]) –
body (
Union
[str
,Mapping
[str
,JSON_ro
]]) – Either markdown or richtext.
- Return type:
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
NO_THING_ID
:The target comment does not exist.
- async delete(idy: int | str) None [source]#
Delete a comment.
If the target doesn’t exist or isn’t valid, nothing happens.
- Parameters:
idy (Union[int, str]) –
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
- async lock(idy: int | str) None [source]#
Lock a comment.
Nothing happens if the target is already locked.
Hint
Locking prevents a submission/comment from receiving new comments. A locked submission is unable to receive any new comments. Locking a comment only stops direct comments, but existing child comments can still receive replies.
- Parameters:
idy (Union[int, str]) –
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
redditwarp.http.exceptions.StatusCodeException –
403
:The target doesn’t exist or you don’t have permission to lock it.
- async unlock(idy: int | str) None [source]#
Unlock a comment.
Behaves similarly to
lock()
.- Parameters:
idy (Union[int, str]) –
- Return type:
None
- Raises:
Similar to
lock()
.
- async vote(idy: int | str, direction: int) None [source]#
Cast a vote on a comment.
- Parameters:
idy (Union[int, str]) –
direction (int) – Either:
1
(upvote),0
unvote,-1
downvote.
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
redditwarp.http.exceptions.StatusCodeException –
404
:The target could not be found.
- async save(idy: int | str, category: str | None = None) None [source]#
Save a comment.
- Parameters:
idy (Union[int, str]) –
category (Optional[str]) –
A category/label.
Requires Reddit Premium. Ignored if no Reddit Premium.
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
redditwarp.http.exceptions.StatusCodeException –
404
:The category name specified was invalid.
- async unsave(idy: int | str) None [source]#
Save a comment.
- Parameters:
idy (Union[int, str]) –
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
- async distinguish(idy: int | str) Comment [source]#
Distinguish a comment.
Hint
Distinguishing decoratates the author’s name by giving it a different color and putting a sigil beside it.
- Parameters:
idy (Union[int, str]) –
- Returns:
The target comment.
- Return type:
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
redditwarp.http.exceptions.StatusCodeException –
403
:You do not have permission to distinguish the target.
404
:The target could not be found.
- async distinguish_and_sticky(idy: int | str) Comment [source]#
Distinguish and sticky a comment.
Only one comment may be stickied at a time. Attempting to sticky a comment when there is already a stickied comment will override that stickied comment. Only top-level comments may be stickied.
- Parameters:
idy (Union[int, str]) –
- Returns:
The target comment.
- Return type:
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
redditwarp.http.exceptions.StatusCodeException –
403
:You do not have permission to distinguish the target.
404
:The target could not be found.
- async undistinguish(idy: int | str) Comment [source]#
Undistinguish a comment.
- Parameters:
idy (Union[int, str]) –
- Returns:
The target comment.
- Return type:
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
redditwarp.http.exceptions.StatusCodeException –
403
:You do not have permission.
404
:The target could not be found.
- async enable_reply_notifications(idy: int | str) None [source]#
Enable inbox reply notifications for a comment.
- Parameters:
idy (Union[int, str]) –
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
- async disable_reply_notifications(idy: int | str) None [source]#
Disable inbox reply notifications for a comment.
- Parameters:
idy (Union[int, str]) –
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
- async approve(idy: int | str) None [source]#
Approve a comment.
- Parameters:
idy (Union[int, str]) –
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
redditwarp.http.exceptions.StatusCodeException –
403
:You do not have permission.
The target specified does not exist.
The target belongs to a subreddit you do not have permission over.
- async remove(idy: int | str) None [source]#
Remove a comment.
This is a moderator action.
- Parameters:
idy (Union[int, str]) –
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
redditwarp.http.exceptions.StatusCodeException –
403
:You do not have permission.
The target specified does not exist.
The target belongs to a subreddit you do not have permission over.
- async ignore_reports(idy: int | str) None [source]#
Ignore reports on a comment.
Hint
If you ignore reports, you won’t receive notifications and the ignored thing will be absent from moderation listings.
Nothing happens if the target is already ignored.
- Parameters:
idy (Union[int, str]) – Comment ID.
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
redditwarp.http.exceptions.StatusCodeException –
403
:The target specified does not exist.
The target belongs to a subreddit you do not have permission over.
- async unignore_reports(idy: int | str) None [source]#
Unignore reports on a comment.
Nothing happens if the target is already unignored.
- Parameters:
idy (Union[int, str]) – Comment ID.
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
redditwarp.http.exceptions.StatusCodeException –
403
:The target specified does not exist.
The target belongs to a subreddit you do not have permission over.
- async snooze_reports(idy: int | str, reason: str) None [source]#
Ignore a custom report reason in a subreddit for 7 days.
- Parameters:
idy (Union[int, str]) – Comment ID.
reason (str) – The custom report reason to snooze.
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
redditwarp.http.exceptions.StatusCodeException –
403
:The target specified does not exist.
The target belongs to a subreddit you do not have permission over.
- async unsnooze_reports(idy: int | str, reason: str) None [source]#
Unsnooze a custom report.
See
snooze_reports()
.
- async apply_removal_reason(idy: int | str, reason_id: str | None = None, note: str | None = None) None [source]#
Set a removal reason on a removed comment.
If the target is not a removed comment, nothing happens.
- Parameters:
idy (Union[int, str]) – Comment ID.
reason_id (Optional[int]) – A removal reason ID.
note (Optional[str]) – A note.
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
JSON_MISSING_KEY
:Empty strings or null values were specified for both
reason_id
andnote
at the same time.
NO_THING_ID
:The given target ID is not valid.
INVALID_ID
:The reason ID is invalid.
MUST_BE_PRESENT
:The subreddit specified does not exist.
redditwarp.http.exceptions.StatusCodeException –
403
:The target specified does not belong to a subreddit you moderate.
- async send_removal_comment(idy: int | str, title: str, message: str, *, exposed: bool = False, locked: bool = False) Comment [source]#
Send a removal comment.
Sends a removal reason comment to a user for a removed comment of theirs.
This action can be performed multiple times. (The UI does not normally let you do this.)
Unlike
apply_removal_reason()
, the target you specify must be a removed item otherwise anINVALID_ID
API error is produced.- Parameters:
idy (Union[int, str]) – ID of a removed comment.
title (str) –
A title.
This is ultimately unused for removal comments, but a non-empty string must be specified or you’ll get a
NO_TEXT
API error.The UI sends the title of the selected removal reason.
message (str) –
A message for the comment body.
Can be an empty string. This is interesting because you can’t normally create comments with empty bodies.
exposed (bool) –
If false (default), the comment will be created by a special moderator named
u/{subreddit}_ModTeam
.If true, the comment is created by the current user.
locked (bool) – Lock the newly created comment.
- Returns:
The newly created comment.
- Return type:
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
NO_TEXT
:The value for the
title
parameter was empty.
INVALID_ID
:The target specified doesn’t exist or is invalid.
The target specified is not a removed item.
MUST_BE_PRESENT
:The subreddit specified does not exist.
redditwarp.http.exceptions.StatusCodeException –
403
:The target specified does not belong to a subreddit you moderate.
- async send_removal_message(idy: int | str, title: str, message: str, *, exposed: bool = False) None [source]#
Send a removal message.
Behaves similarly to
send_removal_comment()
.- Parameters:
idy (Union[int, str]) – ID of a removed comment.
title (str) –
A title.
A non-empty string must be specified or you’ll get a
NO_TEXT
API error.The UI sends the title of the selected removal reason.
message (str) –
A message for the comment body.
Can be an empty string.
exposed (bool) –
If false (default), the comment will be send on behalf of the subreddit.
If true, the comment is sent by the current user.
- Returns:
None
- (raises):