Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# RuleModeration

class praw.models.reddit.rules.RuleModeration(rule: praw.models.Rule)

  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"
      )

  __init__(rule: praw.models.Rule)

    Initialize a `RuleModeration` instance.

  delete()

    Delete a rule from this subreddit.

    To delete `"No spam"` from r/test try:

        reddit.subreddit("test").rules["No spam"].mod.delete()

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

    Update the rule from this subreddit.

    Note

    Existing values will be used for any unspecified arguments.

    Parameters:

      - description – The new description for the rule. Can be empty.

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

    Returns:

      A Rule object containing the updated values.

    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"
        )