RuleModeration

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

Contain methods used to moderate rules.

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

subreddit = await reddit.subreddit("test")
rule = await subreddit.rules.get_rule("No Spam")
await rule.mod.delete()

To update "No spam" from r/test try:

subreddit = await reddit.subreddit("test")
rule = await subreddit.rules.get_rule("No Spam")
await rule.mod.update(description="Don't do this!", violation_reason="Spam post")
__init__(rule: asyncpraw.models.Rule)

Initialize a RuleModeration instance.

await delete()

Delete a rule from this subreddit.

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

subreddit = await reddit.subreddit("test")
rule = await subreddit.rules.get_rule("No Spam")
await rule.mod.delete()
await update(description: Optional[str] = None, kind: Optional[str] = None, short_name: Optional[str] = None, violation_reason: Optional[str] = None) asyncpraw.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:

subreddit = reddit.subreddit("test")
rule = await subreddit.rules.get_rule("No Spam")
await rule.mod.update(description="Don't do this!", violation_reason="Spam post")