Rule¶
-
class
praw.models.Rule(reddit: Reddit, subreddit: Optional[Subreddit] = None, short_name: Optional[str] = None, _data: Optional[Dict[str, str]] = None)¶ An individual Rule object.
Typical Attributes
This table describes attributes that typically belong to objects of this class. Since attributes are dynamically provided (see Determine Available Attributes of an Object), there is not a guarantee that these attributes will always be present, nor is this list necessarily comprehensive.
Attribute
Description
created_utcTime the rule was created, represented in Unix Time.
descriptionThe description of the rule, if provided, otherwise a blank string.
kindThe kind of rule. Can be
"link",comment", or"all".priorityRepresents where the rule is ranked. For example, the first rule is at priority
0. Serves as an index number on the list of rules.short_nameThe name of the rule.
violation_reasonThe reason that is displayed on the report menu for the rule.
-
__init__(reddit: Reddit, subreddit: Optional[Subreddit] = None, short_name: Optional[str] = None, _data: Optional[Dict[str, str]] = None)¶ Construct an instance of the Rule object.
-
mod()¶ Contain methods used to moderate rules.
To delete
"No spam"from the subreddit"NAME"try:reddit.subreddit("NAME").rules["No spam"].mod.delete()
To update
"No spam"from the subreddit"NAME"try:reddit.subreddit("NAME").removal_reasons["No spam"].mod.update( description="Don't do this!", violation_reason="Spam post" )
-