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 parsed UTC 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.

date

The UTC timestamp on which the moderator was added.

id

The Redditor’s fullname (t2_ID).

mod_permissions

A list of all the moderator permissions or ["all"].

name

The Redditor’s name.

__str__()

Returns the Redditor’s name.

Returns

name – The Redditor’s name.

Return type

str

async fetch()

Fetch this item’s information from a suitable API endpoint.

Returns

self – The updated model.

Return type

aPRAWBase

property fullname

Get the ID prepended with its kind.

Returns

fullname – The item’s ID prepended with its kind such as t1_.

Return type

str

async redditor() apraw.models.reddit.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(reddit: Reddit, subreddit: Subreddit)

A helper class for grabbing listings to Subreddit moderation items.

edited(*args, **kwargs)

Returns an instance of ListingGenerator mapped to grab edited items.

Note

This listing can be streamed doing the following:

for comment in subreddit.mod.edited.stream():
    print(comment)
Parameters

kwargs (**Dict) – ListingGenerator kwargs.

Returns

generator – A ListingGenerator mapped to grab edited items.

Return type

ListingGenerator

log(*args, **kwargs)

Returns an instance of ListingGenerator mapped to grab mod actions in the subreddit log.

Note

This listing can be streamed doing the following:

for comment in subreddit.mod.log.stream():
    print(comment)
Parameters

kwargs (**Dict) – ListingGenerator kwargs.

Returns

generator – A ListingGenerator mapped to grab mod actions in the subreddit log.

Return type

ListingGenerator

modqueue(*args, **kwargs)

Returns an instance of ListingGenerator mapped to grab items in the modqueue.

Note

This listing can be streamed doing the following:

for comment in subreddit.mod.modqueue.stream():
    print(comment)
Parameters

kwargs (**Dict) – ListingGenerator kwargs.

Returns

generator – A ListingGenerator mapped to grab items in the modqueue.

Return type

ListingGenerator

reports(*args, **kwargs)

Returns an instance of ListingGenerator mapped to grab reported items.

Note

This listing can be streamed doing the following:

for comment in subreddit.mod.reports.stream():
    print(comment)
Parameters

kwargs (**Dict) – ListingGenerator kwargs.

Returns

generator – A ListingGenerator mapped to grab reported items.

Return type

ListingGenerator

async settings() apraw.models.subreddit.settings.SubredditSettings

Retrieve the settings for the subreddit this helper works for.

Returns

settings – The subreddit’s settings with their data prefetched.

Return type

SubredditSettings

spam(*args, **kwargs)

Returns an instance of ListingGenerator mapped to grab items marked as spam.

Note

This listing can be streamed doing the following:

for comment in subreddit.mod.spam.stream():
    print(comment)
Parameters

kwargs (**Dict) – ListingGenerator kwargs.

Returns

generator – A ListingGenerator mapped to grab items marked as spam.

Return type

ListingGenerator

unmoderated(*args, **kwargs)

Returns an instance of ListingGenerator mapped to grab unmoderated items.

Note

This listing can be streamed doing the following:

for comment in subreddit.mod.unmoderated.stream():
    print(comment)
Parameters

kwargs (**Dict) – ListingGenerator kwargs.

Returns

generator – A ListingGenerator mapped to grab unmoderated items.

Return type

ListingGenerator

SubredditSettings

class apraw.models.SubredditSettings(reddit: Reddit, data: Dict[str, Any], subreddit: Subreddit = None)

A model representing subreddit settings.

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

all_original_content

Whether the subreddit only allows original content.

allow_chat_post_creation

Whether the subreddit allows chat post creation.

allow_discovery

Whether this subreddit can be discovered through the recommendations.

allow_galleries

Whether this subreddit allows submissions with galleries.

allow_images

Whether this subreddit allows image posts.

allow_polls

Whether this subreddit allows poll posts.

allow_post_crossposts

Whether this subreddit allows crossposts.

allow_videos

Whether this subreddit allows video submissions.

collapse_deleted_comments

Whether deleted comments in threads should be automatically collapsed.

comment_score_hide_mins

The comment score below which comments should be hidden.

content_options

string

crowd_control_chat_level

int

crowd_control_level

int

crowd_control_mode

bool

default_set

bool

description

The subreddit’s short description.

disable_contributor_requests

bool

domain

None

exclude_banned_modqueue

Whether banned users should be excluded from the modqueue.

free_form_reports

Whether users can submit custom text reports.

header_hover_text

The hover text for the subreddit’s header.

hide_ads

Whether ads should be hidden on this subreddit.

key_color

string

language

The subreddit’s default language as a language code (i.e. “en” for English).

original_content_tag_enabled

Whether the subreddit has the OC tag enabled.

over_18

Whether this subreddit is marked NSFW.

public_description

The subreddit’s public description.

public_traffic

bool

restrict_commenting

Whether comments are restricted on the subreddit.

restrict_posting

Whether posts are restricted on the subreddit.

show_media_preview

Whether media previews should be displayed by clients.

show_media

bool

spam_comments

The comment spam filter’s setting, either “low”, “medium” or “high”.

spam_links

The link spam filter’s setting, either “low”, “medium” or “high”.

spam_selfposts

The selfpost spam filter’s setting, either “low”, “medium” or “high”.

spoilers_enabled

Whether the spoiler marker has been enabled on this subreddit.

submit_link_label

The submit button’s label.

submit_text_label

The submit text’s label.

submit_text

string

subreddit_id

The ID of the subreddit with the prepended kind i.e. t5_.

subreddit_type

One of “public”, “private” or “restricted”.

suggested_comment_sort

The default comment sort for submissions.

title

The subreddit’s name.

toxicity_threshold_chat_level

int

welcome_message_enabled

Whether the subreddit has enabled welcome messages.

welcome_message_text

The welcome message’s text of this subreddit.

wiki_edit_age

The minimum account age requirement for wiki editors.

wiki_edit_karma

The minimum account karma requirement for wiki editors.

wikimode

The mode the wiki is in e.g. “modonly”.

async fetch() apraw.models.subreddit.settings.SubredditSettings

Fetch this item’s information from a suitable API endpoint.

Returns

self – The SubredditSettings model with updated data.

Return type

SubredditSettings

property fullname

Get the ID prepended with its kind.

Returns

fullname – The item’s ID prepended with its kind such as t1_.

Return type

str

async subreddit() Subreddit

Retrieve the subreddit this item was made in as a Subreddit.

Returns

subreddit – The subreddit this item was made in.

Return type

Subreddit

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.

async mod() apraw.models.reddit.redditor.Redditor

Returns the Redditor who performed this action.

Returns

redditor – The Redditor who performed this action.

Return type

Redditor