SubmissionModeration¶
- class praw.models.reddit.submission.SubmissionModeration(submission: praw.models.Submission)¶
Provide a set of functions pertaining to Submission moderation.
Example usage:
submission = reddit.submission(id="8dmv8z") submission.mod.approve()
- __init__(submission: praw.models.Submission)¶
Create a SubmissionModeration instance.
- Parameters
submission – The submission to moderate.
- approve()¶
Approve a
Comment
orSubmission
.Approving a comment or submission reverts a removal, resets the report counter, adds a green check mark indicator (only visible to other moderators) on the website view, and sets the
approved_by
attribute to the authenticated user.Example usage:
# approve a comment: comment = reddit.comment("dkk4qjd") comment.mod.approve() # approve a submission: submission = reddit.submission(id="5or86n") submission.mod.approve()
- contest_mode(state: bool = True)¶
Set contest mode for the comments of this submission.
- Parameters
state – (boolean) True enables contest mode, False, disables (default: True).
Contest mode have the following effects:
The comment thread will default to being sorted randomly.
Replies to top-level comments will be hidden behind “[show replies]” buttons.
Scores will be hidden from non-moderators.
Scores accessed through the API (mobile apps, bots) will be obscured to “1” for non-moderators.
Example usage:
submission = reddit.submission(id="5or86n") submission.mod.contest_mode(state=True)
- distinguish(how='yes', sticky=False)¶
Distinguish a
Comment
orSubmission
.- Parameters
how – One of “yes”, “no”, “admin”, “special”. “yes” adds a moderator level distinguish. “no” removes any distinction. “admin” and “special” require special user privileges to use.
sticky – Comment is stickied if
True
, placing it at the top of the comment page regardless of score. If thing is not a top-level comment, this parameter is silently ignored.
Example usage:
# distinguish and sticky a comment: comment = reddit.comment("dkk4qjd") comment.mod.distinguish(how="yes", sticky=True) # undistinguish a submission: submission = reddit.submission(id="5or86n") submission.mod.distinguish(how="no")
See also
- flair(text: str = '', css_class: str = '', flair_template_id: Optional[str] = None)¶
Set flair for the submission.
- Parameters
text – The flair text to associate with the Submission (default: “”).
css_class – The css class to associate with the flair html (default: “”).
flair_template_id – The flair template id to use when flairing (Optional).
This method can only be used by an authenticated user who is a moderator of the Submission’s Subreddit.
Example usage:
submission = reddit.submission(id="5or86n") submission.mod.flair(text="PRAW", css_class="bot")
- ignore_reports()¶
Ignore future reports on a
Comment
orSubmission
.Calling this method will prevent future reports on this Comment or Submission from both triggering notifications and appearing in the various moderation listings. The report count will still increment on the Comment or Submission.
Example usage:
# ignore future reports on a comment: comment = reddit.comment("dkk4qjd") comment.mod.ignore_reports() # ignore future reports on a submission: submission = reddit.submission(id="5or86n") submission.mod.ignore_reports()
See also
- lock()¶
Lock a
Comment
orSubmission
.Example usage:
# lock a comment: comment = reddit.comment("dkk4qjd") comment.mod.lock() # lock a submission: submission = reddit.submission(id="5or86n") submission.mod.lock()
See also
- nsfw()¶
Mark as not safe for work.
This method can be used both by the submission author and moderators of the subreddit that the submission belongs to.
Example usage:
submission = reddit.subreddit("test").submit("nsfw test", selftext="nsfw") submission.mod.nsfw()
See also
- remove(spam=False, mod_note='', reason_id=None)¶
Remove a
Comment
orSubmission
.- Parameters
mod_note – A message for the other moderators.
spam – When True, use the removal to help train the Subreddit’s spam filter (default: False).
reason_id – The removal reason ID.
If either
reason_id
ormod_note
are provided, a second API call is made to add the removal reason.Example usage:
# remove a comment and mark as spam: comment = reddit.comment("dkk4qjd") comment.mod.remove(spam=True) # remove a submission submission = reddit.submission(id="5or86n") submission.mod.remove() # remove a submission with a removal reason reason = reddit.subreddit.mod.removal_reasons["110ni21zo23ql"] submission = reddit.submission(id="5or86n") submission.mod.remove(reason_id=reason.id)
- send_removal_message(message, title='ignored', type='public')¶
Send a removal message for a
Comment
orSubmission
.Warning
The object has to be removed before giving it a removal reason. Remove the object with
remove()
. Trying to add a removal reason without removing the object will result inRedditAPIException
being thrown with anINVALID_ID
error_type.Reddit adds human-readable information about the object to the message.
- Parameters
type – One of “public”, “private”, “private_exposed”. “public” leaves a stickied comment on the post. “private” sends a Modmail message with hidden username. “private_exposed” sends a Modmail message without hidden username.
title – The short reason given in the message. (Ignored if type is “public”.)
message – The body of the message.
If
type
is “public”, the newComment
is returned.
- set_original_content()¶
Mark as original content.
This method can be used by moderators of the subreddit that the submission belongs to. If the subreddit has enabled the Original Content beta feature in settings, then the submission’s author can use it as well.
Example usage:
submission = reddit.subreddit("test").submit("oc test", selftext="original") submission.mod.set_original_content()
See also
- sfw()¶
Mark as safe for work.
This method can be used both by the submission author and moderators of the subreddit that the submission belongs to.
Example usage:
submission = reddit.submission(id="5or86n") submission.mod.sfw()
See also
- spoiler()¶
Indicate that the submission contains spoilers.
This method can be used both by the submission author and moderators of the subreddit that the submission belongs to.
Example usage:
submission = reddit.submission(id="5or86n") submission.mod.spoiler()
See also
- sticky(state: bool = True, bottom: bool = True)¶
Set the submission’s sticky state in its subreddit.
- Parameters
state – (boolean) True sets the sticky for the submission, false unsets (default: True).
bottom – (boolean) When true, set the submission as the bottom sticky. If no top sticky exists, this submission will become the top sticky regardless (default: True).
Note
When a submission is stickied two or more times, the Reddit API responds with a 409 error that is raises as a
Conflict
by prawcore. The method suppresses theseConflict
errors.This submission will replace the second stickied submission if one exists.
For example:
submission = reddit.submission(id="5or86n") submission.mod.sticky()
- suggested_sort(sort: str = 'blank')¶
Set the suggested sort for the comments of the submission.
- Parameters
sort – Can be one of: confidence, top, new, controversial, old, random, qa, blank (default: blank).
- undistinguish()¶
Remove mod, admin, or special distinguishing from an object.
Also unstickies the object if applicable.
Example usage:
# undistinguish a comment: comment = reddit.comment("dkk4qjd") comment.mod.undistinguish() # undistinguish a submission: submission = reddit.submission(id="5or86n") submission.mod.undistinguish()
See also
- unignore_reports()¶
Resume receiving future reports on a Comment or Submission.
Future reports on this
Comment
orSubmission
will cause notifications, and appear in the various moderation listings.Example usage:
# accept future reports on a comment: comment = reddit.comment("dkk4qjd") comment.mod.unignore_reports() # accept future reports on a submission: submission = reddit.submission(id="5or86n") submission.mod.unignore_reports()
See also
- unlock()¶
Unlock a
Comment
orSubmission
.Example usage:
# unlock a comment: comment = reddit.comment("dkk4qjd") comment.mod.unlock() # unlock a submission: submission = reddit.submission(id="5or86n") submission.mod.unlock()
See also
- unset_original_content()¶
Indicate that the submission is not original content.
This method can be used by moderators of the subreddit that the submission belongs to. If the subreddit has enabled the Original Content beta feature in settings, then the submission’s author can use it as well.
Example usage:
submission = reddit.subreddit("test").submit("oc test", selftext="original") submission.mod.unset_original_content()
See also
- unspoiler()¶
Indicate that the submission does not contain spoilers.
This method can be used both by the submission author and moderators of the subreddit that the submission belongs to.
For example:
submission = reddit.subreddit("test").submit("not spoiler", selftext="spoiler") submission.mod.unspoiler()
See also