Rule#
- class praw.models.Rule(reddit: praw.Reddit, subreddit: Optional[praw.models.Subreddit] = None, short_name: Optional[str] = None, _data: Optional[Dict[str, str]] = None)#
An individual
Ruleobject.Typical Attributes
Note
This table describes attributes that typically belong to objects of this class. PRAW dynamically provides the attributes that Reddit returns via the API. Since those attributes are subject to change on Reddit’s end, PRAW makes no effort to document any new/removed/changed attributes, other than to instruct you on how to discover what is available. As a result, this table of attributes may not be complete. See Determine Available Attributes of an Object for detailed information.
If you would like to add an attribute to this table, feel free to open a pull request.
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: praw.Reddit, subreddit: Optional[praw.models.Subreddit] = None, short_name: Optional[str] = None, _data: Optional[Dict[str, str]] = None)#
Initialize a
Ruleinstance.
- mod() praw.models.reddit.rules.RuleModeration#
Contain methods used to moderate rules.
To delete
"No spam"from r/test try:reddit.subreddit("test").rules["No spam"].mod.delete()
To update
"No spam"from r/test try:reddit.subreddit("test").removal_reasons["No spam"].mod.update( description="Don't do this!", violation_reason="Spam post" )