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
aPRAWBaseclass and may vary depending on the status of the response and expected objects.Attribute
Description
addedThe parsed UTC date on which the moderator was added.
author_flair_css_classThe moderator’s flair CSS class in the respective subreddit.
author_flair_textThe moderator’s flair text in the respective subreddit.
dateThe UTC timestamp on which the moderator was added.
idThe Redditor’s fullname (t2_ID).
mod_permissionsA list of all the moderator permissions or
["all"].nameThe 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
- 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
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
ListingGeneratormapped 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) –
ListingGeneratorkwargs.- Returns
generator – A
ListingGeneratormapped to grab edited items.- Return type
- log(*args, **kwargs)¶
Returns an instance of
ListingGeneratormapped 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) –
ListingGeneratorkwargs.- Returns
generator – A
ListingGeneratormapped to grab mod actions in the subreddit log.- Return type
- modqueue(*args, **kwargs)¶
Returns an instance of
ListingGeneratormapped 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) –
ListingGeneratorkwargs.- Returns
generator – A
ListingGeneratormapped to grab items in the modqueue.- Return type
- reports(*args, **kwargs)¶
Returns an instance of
ListingGeneratormapped 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) –
ListingGeneratorkwargs.- Returns
generator – A
ListingGeneratormapped to grab reported items.- Return type
- 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
- spam(*args, **kwargs)¶
Returns an instance of
ListingGeneratormapped 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) –
ListingGeneratorkwargs.- Returns
generator – A
ListingGeneratormapped to grab items marked as spam.- Return type
- unmoderated(*args, **kwargs)¶
Returns an instance of
ListingGeneratormapped 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) –
ListingGeneratorkwargs.- Returns
generator – A
ListingGeneratormapped to grab unmoderated items.- Return type
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
aPRAWBaseclass and may vary depending on the status of the response and expected objects.Attribute
Description
all_original_contentWhether the subreddit only allows original content.
allow_chat_post_creationWhether the subreddit allows chat post creation.
allow_discoveryWhether this subreddit can be discovered through the recommendations.
allow_galleriesWhether this subreddit allows submissions with galleries.
allow_imagesWhether this subreddit allows image posts.
allow_pollsWhether this subreddit allows poll posts.
allow_post_crosspostsWhether this subreddit allows crossposts.
allow_videosWhether this subreddit allows video submissions.
collapse_deleted_commentsWhether deleted comments in threads should be automatically collapsed.
comment_score_hide_minsThe comment score below which comments should be hidden.
content_optionsstringcrowd_control_chat_levelintcrowd_control_levelintcrowd_control_modebooldefault_setbooldescriptionThe subreddit’s short description.
disable_contributor_requestsbooldomainNoneexclude_banned_modqueueWhether banned users should be excluded from the modqueue.
free_form_reportsWhether users can submit custom text reports.
header_hover_textThe hover text for the subreddit’s header.
hide_adsWhether ads should be hidden on this subreddit.
key_colorstringlanguageThe subreddit’s default language as a language code (i.e. “en” for English).
original_content_tag_enabledWhether the subreddit has the OC tag enabled.
over_18Whether this subreddit is marked NSFW.
public_descriptionThe subreddit’s public description.
public_trafficboolrestrict_commentingWhether comments are restricted on the subreddit.
restrict_postingWhether posts are restricted on the subreddit.
show_media_previewWhether media previews should be displayed by clients.
show_mediaboolspam_commentsThe comment spam filter’s setting, either “low”, “medium” or “high”.
spam_linksThe link spam filter’s setting, either “low”, “medium” or “high”.
spam_selfpostsThe selfpost spam filter’s setting, either “low”, “medium” or “high”.
spoilers_enabledWhether the spoiler marker has been enabled on this subreddit.
submit_link_labelThe submit button’s label.
submit_text_labelThe submit text’s label.
submit_textstringsubreddit_idThe ID of the subreddit with the prepended kind i.e.
t5_.subreddit_typeOne of “public”, “private” or “restricted”.
suggested_comment_sortThe default comment sort for submissions.
titleThe subreddit’s name.
toxicity_threshold_chat_levelintwelcome_message_enabledWhether the subreddit has enabled welcome messages.
welcome_message_textThe welcome message’s text of this subreddit.
wiki_edit_ageThe minimum account age requirement for wiki editors.
wiki_edit_karmaThe minimum account karma requirement for wiki editors.
wikimodeThe 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
SubredditSettingsmodel with updated data.- Return type
- 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
ModAction¶
- class apraw.models.ModAction(reddit, data, subreddit=None)¶
A model representing mod actions taken on specific items.
- reddit: Reddit
The
Redditinstance 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
aPRAWBaseclass and may vary depending on the status of the response and expected objects.Attribute
Description
actionThe type of action performed.
created_utcThe parsed UTC datetime of when the action was performed.
descriptionThe description added to the action if applicable.
detailsThe details of the action performed.
idThe ID of the mod action prepended with “ModAction”.
mod_id36The ID36 of the moderator who performed the action.
modThe username of the moderator who performed the action.
sr_id36The ID36 of the subreddit the action was performed on.
subreddit_name_prefixedThe name of the subreddit the action was performed on prefixed with “r/”.
subredditThe name of the subreddit the action was performed on.
target_authorThe author of the target item if applicable.
target_bodyThe body of the target item if applicable.
target_fullnameThe id of the target with its kind prepended. (e.g. “t3_d5229o”)
target_permalinkThe target of the comment or submission if applicable.
target_titleThe 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