CommentModeration

class praw.models.reddit.comment.CommentModeration(comment)

Provide a set of functions pertaining to Comment moderation.

Example usage:

comment = reddit.comment('dkk4qjd')
comment.mod.approve()
__init__(comment)

Create a CommentModeration instance.

Parameters:comment – The comment to moderate.
approve()

Approve a Comment or Submission.

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()
distinguish(how='yes', sticky=False)

Distinguish a Comment or Submission.

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 undistinguish()

ignore_reports()

Ignore future reports on a Comment or Submission.

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 unignore_reports()

lock()

Lock the a Comment or Submission.

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 unlock()

remove(spam=False)

Remove a Comment or Submission.

Parameters:spam – When True, use the removal to help train the Subreddit’s spam filter (default: False).

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()
send_removal_message(message, title='ignored', type='public')

Send a removal message for a Comment or Submission.

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 new Comment is returned.

undistinguish()

Remove mod, admin, or special distinguishing on 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 distinguish()

unignore_reports()

Resume receiving future reports on a Comment or Submission.

Future reports on this Comment or Submission 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 ignore_reports()

unlock()

Unlock the a Comment or Submission.

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 lock()