CommentModeration

class asyncpraw.models.reddit.comment.CommentModeration(comment: asyncpraw.models.Comment)

Provide a set of functions pertaining to Comment moderation.

Example usage:

comment = await reddit.comment("dkk4qjd", fetch=False)
await comment.mod.approve()
__init__(comment: asyncpraw.models.Comment)

Initialize a CommentModeration instance.

Parameters

comment – The comment to moderate.

await 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 = await reddit.comment("dkk4qjd", fetch=False)
await comment.mod.approve()
# approve a submission:
submission = await reddit.submission("5or86n", fetch=False)
await submission.mod.approve()
await distinguish(how='yes', sticky=False)

Distinguish a Comment or Submission.

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.

  • stickyComment 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 (default False).

Example usage:

# distinguish and sticky a comment:
comment = await reddit.comment("dkk4qjd", fetch=False)
await comment.mod.distinguish(how="yes", sticky=True)
# undistinguish a submission:
submission = await reddit.submission("5or86n", fetch=False)
await submission.mod.distinguish(how="no")

See also

undistinguish()

await 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 = await reddit.comment("dkk4qjd", fetch=False)
await comment.mod.ignore_reports()
# ignore future reports on a submission:
submission = await reddit.submission("5or86n", fetch=False)
await submission.mod.ignore_reports()
await lock()

Lock a Comment or Submission.

Example usage:

# lock a comment:
comment = await reddit.comment("dkk4qjd", fetch=False)
await comment.mod.lock()
# lock a submission:
submission = await reddit.submission("5or86n", fetch=False)
await submission.mod.lock()

See also

unlock()

await remove(spam=False, mod_note='', reason_id=None)

Remove a Comment or Submission.

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 or mod_note are provided, a second API call is made to add the removal reason.

Example usage:

# remove a comment and mark as spam:
comment = await reddit.comment("dkk4qjd", fetch=False)
await comment.mod.remove(spam=True)
# remove a submission
submission = await reddit.submission("5or86n", fetch=False)
await submission.mod.remove()
# remove a submission with a removal reason
sub = await reddit.subreddit("test")
reason = await sub.mod.removal_reasons.get_reason("110ni21zo23ql")
submission = await reddit.submission("5or86n", fetch=False)
await submission.mod.remove(reason_id=reason.id)
await send_removal_message(message, title='ignored', type='public')

Send a removal message for a Comment or Submission.

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 in RedditAPIException being thrown with an INVALID_ID error_type.

Reddit adds human-readable information about the object to the message.

Parameters
  • type – One of "public", "private", or "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 (default: "public").

  • title – The short reason given in the message. Ignored if type is "public".

  • message – The body of the message.

Returns

The new Comment if type is "public".

await show()

Uncollapse a Comment that has been collapsed by Crowd Control.

Example usage:

# Uncollapse a comment:
comment = await reddit.comment("dkk4qjd", fetch=False)
await comment.mod.show()
await undistinguish()

Remove mod, admin, or special distinguishing from an object.

Also unstickies the object if applicable.

Example usage:

# undistinguish a comment:
comment = await reddit.comment("dkk4qjd", fetch=False)
await comment.mod.undistinguish()
# undistinguish a submission:
submission = await reddit.submission("5or86n", fetch=False)
await submission.mod.undistinguish()

See also

distinguish()

await 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 = await reddit.comment("dkk4qjd", fetch=False)
await comment.mod.unignore_reports()
# accept future reports on a submission:
submission = await reddit.submission("5or86n", fetch=False)
await submission.mod.unignore_reports()

See also

ignore_reports()

await unlock()

Unlock a Comment or Submission.

Example usage:

# unlock a comment:
comment = await reddit.comment("dkk4qjd", fetch=False)
await comment.mod.unlock()
# unlock a submission:
submission = await reddit.submission("5or86n", fetch=False)
await submission.mod.unlock()

See also

lock()