CommentModeration#
- class praw.models.reddit.comment.CommentModeration(comment: praw.models.Comment)#
Provide a set of functions pertaining to
Commentmoderation.Example usage:
comment = reddit.comment("dkk4qjd") comment.mod.approve()
- __init__(comment: praw.models.Comment)#
Initialize a
CommentModerationinstance.- Parameters:
comment – The comment to moderate.
- approve()#
Approve a
CommentorSubmission.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_byattribute to the authenticated user.Example usage:
# approve a comment: comment = reddit.comment("dkk4qjd") comment.mod.approve() # approve a submission: submission = reddit.submission("5or86n") submission.mod.approve()
- author_notes(**generator_kwargs) Generator[praw.models.ModNote, None, None]#
Get the moderator notes for the author of this object in the subreddit it’s posted in.
- Parameters:
generator_kwargs – Additional keyword arguments are passed in the initialization of the moderator note generator.
- Returns:
A generator of
ModNote.
For example, to list all notes the author of a submission, try:
for note in reddit.submission("92dd8").mod.author_notes(): print(f"{note.label}: {note.note}")
- create_note(*, label: Optional[str] = None, note: str, **other_settings) praw.models.ModNote#
Create a moderator note on the author of this object in the subreddit it’s posted in.
- Parameters:
label – The label for the note. As of this writing, this can be one of the following:
"ABUSE_WARNING","BAN","BOT_BAN","HELPFUL_USER","PERMA_BAN","SOLID_CONTRIBUTOR","SPAM_WARNING","SPAM_WATCH", orNone(default:None).note – The content of the note. As of this writing, this is limited to 250 characters.
other_settings – Additional keyword arguments are passed to
create().
- Returns:
The new
ModNoteobject.
For example, to create a note on a
Submission, try:reddit.submission("92dd8").mod.create_note(label="HELPFUL_USER", note="Test note")
- distinguish(*, how: str = 'yes', sticky: bool = False)#
Distinguish a
CommentorSubmission.- Parameters:
how – One of
"yes","no","admin", or"special"."yes"adds a moderator level distinguish."no"removes any distinction."admin"and"special"require special user privileges to use (default"yes").sticky –
Commentis stickied ifTrue, 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 (defaultFalse).
Example usage:
# distinguish and sticky a comment: comment = reddit.comment("dkk4qjd") comment.mod.distinguish(sticky=True) # undistinguish a submission: submission = reddit.submission("5or86n") submission.mod.distinguish(how="no")
See also
- ignore_reports()#
Ignore future reports on a
CommentorSubmission.Calling this method will prevent future reports on this
CommentorSubmissionfrom both triggering notifications and appearing in the various moderation listings. The report count will still increment on theCommentorSubmission.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("5or86n") submission.mod.ignore_reports()
See also
- lock()#
Lock a
CommentorSubmission.Example usage:
# lock a comment: comment = reddit.comment("dkk4qjd") comment.mod.lock() # lock a submission: submission = reddit.submission("5or86n") submission.mod.lock()
See also
- remove(*, mod_note: str = '', spam: bool = False, reason_id: Optional[str] = None)#
Remove a
CommentorSubmission.- Parameters:
mod_note – A message for the other moderators.
spam – When
True, use the removal to help train theSubreddit’s spam filter (default:False).reason_id – The removal reason ID.
If either
reason_idormod_noteare 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("5or86n") submission.mod.remove() # remove a submission with a removal reason reason = reddit.subreddit.mod.removal_reasons["110ni21zo23ql"] submission = reddit.submission("5or86n") submission.mod.remove(reason_id=reason.id)
- send_removal_message(*, message: str, title: str = 'ignored', type: str = 'public') Optional[praw.models.Comment]#
Send a removal message for a
CommentorSubmission.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 inRedditAPIExceptionbeing thrown with anINVALID_IDerror_type.Reddit adds human-readable information about the object to the message.
- Parameters:
type – One of
"public","public_as_subreddit","private", or"private_exposed"."public"leaves a stickied comment on the post."public_as_subreddit"leaves a stickied comment on the post with the u/subreddit-ModTeam account."private"sends a modmail message with hidden username."private_exposed"sends a modmail message without hidden username (default:"public").title – The short reason given in the message. Ignored if type is
"public"or"public_as_subreddit".message – The body of the message.
- Returns:
The new
Commentiftypeis"public"or"public_as_subreddit".
- show()#
Uncollapse a
Commentthat has been collapsed by Crowd Control.Example usage:
# Uncollapse a comment: comment = reddit.comment("dkk4qjd") comment.mod.show()
- 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("5or86n") submission.mod.undistinguish()
See also
- unignore_reports()#
Resume receiving future reports on a
CommentorSubmission.Future reports on this
CommentorSubmissionwill 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("5or86n") submission.mod.unignore_reports()
See also
- unlock()#
Unlock a
CommentorSubmission.Example usage:
# unlock a comment: comment = reddit.comment("dkk4qjd") comment.mod.unlock() # unlock a submission: submission = reddit.submission("5or86n") submission.mod.unlock()
See also