Subreddit Moderation

This section details the usage of models related to subreddit moderation.

SubredditModerator

Subreddit moderators are usually retrieved as follows:

sub = await reddit.subreddit("aprawtest")
moderators = []
async for moderator in sub.moderators():
    moderators.append(str(moderator))
class apraw.models.SubredditModerator(reddit: Reddit, data: Dict)

The model representing subreddit moderators. Redditors can be retrieved via redditor().

Typical Attributes

This table describes attributes that typically belong to objects of this class. Attributes are dynamically provided by the aPRAWBase class and may vary depending on the status of the response and expected objects.

Attribute Description
added The date on which the moderator was added.
author_flair_css_class The moderator’s flair CSS class in the respective subreddit.
author_flair_text The moderator’s flair text in the respective subreddit.
id The Redditor’s fullname (t2_ID).
mod_permissions A list of all the moderator permissions or ["all"].
name The Redditor’s name.
redditor() → apraw.models.redditor.Redditor

Retrieve the Redditor this Moderator represents.

Returns:redditor – The Redditor that is represented by this object.
Return type:Redditor

SubredditModeration

Items in the modqueue can be fetched using the modqueue listing:

sub = await reddit.subreddit("aprawtest")
async for item in sub.mod.modqueue(): # can also be streamed
    print(type(item))
    >>> apraw.models.Comment or apraw.models.Submission
class apraw.models.SubredditModeration(subreddit)

A helper class for grabbing listings to Subreddit moderation items.

reports: ListingGenerator
Returns an instance of ListingGenerator mapped to grab reported items.
spam: ListingGenerator
Returns an instance of ListingGenerator mapped to grab items marked as spam.
modqueue: ListingGenerator
Returns an instance of ListingGenerator mapped to grab items in the modqueue.
unmoderated: ListingGenerator
Returns an instance of ListingGenerator mapped to grab unmoderated items.
edited: ListingGenerator
Returns an instance of ListingGenerator mapped to grab edited items.
log: ListingGenerator
Returns an instance of ListingGenerator mapped to grab mod actions in the subreddit log.

ModAction

class apraw.models.ModAction(reddit, data, subreddit=None)

A model representing mod actions taken on specific items.

reddit: Reddit
The Reddit instance with which requests are made.
data: Dict
The data obtained from the /about endpoint.
kind: str
The item’s kind / type.

Typical Attributes

This table describes attributes that typically belong to objects of this class. Attributes are dynamically provided by the aPRAWBase class and may vary depending on the status of the response and expected objects.

Attribute Description
action The type of action performed.
created_utc The parsed UTC datetime of when the action was performed.
description The description added to the action if applicable.
details The details of the action performed.
id The ID of the mod action prepended with “ModAction”.
mod_id36 The ID36 of the moderator who performed the action.
mod The username of the moderator who performed the action.
sr_id36 The ID36 of the subreddit the action was performed on.
subreddit_name_prefixed The name of the subreddit the action was performed on prefixed with “r/”.
subreddit The name of the subreddit the action was performed on.
target_author The author of the target item if applicable.
target_body The body of the target item if applicable.
target_fullname The id of the target with its kind prepended. (e.g. “t3_d5229o”)
target_permalink The target of the comment or submission if applicable.
target_title The title of the submission if applicable.
mod() → apraw.models.redditor.Redditor

Returns the Redditor who performed this action.

Returns:redditor – The Redditor who performed this action.
Return type:Redditor