SubredditRulesModeration

class praw.models.reddit.rules.SubredditRulesModeration(subreddit_rules: praw.models.reddit.rules.SubredditRules)

Contain methods to moderate subreddit rules as a whole.

To add rule "No spam" to r/test try:

reddit.subreddit("test").rules.mod.add(
    short_name="No spam", kind="all", description="Do not spam. Spam bad"
)

To move the fourth rule to the first position, and then to move the prior first rule to where the third rule originally was in r/test:

subreddit = reddit.subreddit("test")
rules = list(subreddit.rules)
new_rules = rules[3:4] + rules[1:3] + rules[0:1] + rules[4:]
# Alternate: [rules[3]] + rules[1:3] + [rules[0]] + rules[4:]
new_rule_list = subreddit.rules.mod.reorder(new_rules)
__init__(subreddit_rules: praw.models.reddit.rules.SubredditRules)

Initialize a SubredditRulesModeration instance.

add(*, description: str = '', kind: str, short_name: str, violation_reason: Optional[str] = None) praw.models.Rule

Add a removal reason to this subreddit.

Parameters
  • description – The description for the rule.

  • kind – The kind of item that the rule applies to. One of "link", "comment", or "all".

  • short_name – The name of the rule.

  • violation_reason – The reason that is shown on the report menu. If a violation reason is not specified, the short name will be used as the violation reason.

Returns

The added Rule.

To add rule "No spam" to r/test try:

reddit.subreddit("test").rules.mod.add(
    short_name="No spam", kind="all", description="Do not spam. Spam bad"
)
reorder(rule_list: List[praw.models.Rule]) List[praw.models.Rule]

Reorder the rules of a subreddit.

Parameters

rule_list – The list of rules, in the wanted order. Each index of the list indicates the position of the rule.

Returns

A list containing the rules in the specified order.

For example, to move the fourth rule to the first position, and then to move the prior first rule to where the third rule originally was in r/test:

subreddit = reddit.subreddit("test")
rules = list(subreddit.rules)
new_rules = rules[3:4] + rules[1:3] + rules[0:1] + rules[4:]
# Alternate: [rules[3]] + rules[1:3] + [rules[0]] + rules[4:]
new_rule_list = subreddit.rules.mod.reorder(new_rules)