LFG-Cares / SubredditLog

A Moderation Log for Subreddit Moderators with Both Public and Private Interfaces
https://subredditlog.readthedocs.io/en/latest/
Apache License 2.0
2 stars 1 forks source link

Allow for the Importing of Subreddit Rules via API #1

Closed seancallaway closed 1 year ago

seancallaway commented 1 year ago

Allow for the importation of subreddit rules during initial setup. /r/lfg's rules appear as follows:

{
  "rules": [
    {
      "kind": "all",
      "description": "Recruiting for outside communities, servers, services, and any groups that require any ongoing recruitment may only be done in our stickied weekly community thread. Such recruitment is not permitted as full posts even if the community thread is down.\n\nA pool of players rather than a closed table is considered a community.\n\n[MORE INFO](https://www.reddit.com/r/lfg/wiki/index/rules)",
      "short_name": "Discord servers, Western Marches, Outside communities",
      "violation_reason": "Discord servers, Western Marches, Outside communities",
      "created_utc": 1531639988.0,
      "priority": 0,
      "description_html": "--redacted--"
    },
    {
      "kind": "all",
      "description": "Posts must be searching for players of a tabletop game. Although virtual tabletops are allowed, video games are not. We even allow board games!\n\n[MORE INFO](https://www.reddit.com/r/lfg/wiki/index/rules)",
      "short_name": "Tabletop only",
      "violation_reason": "Tabletop only",
      "created_utc": 1531640021.0,
      "priority": 1,
      "description_html": "--redacted--"
    },
    {
      "kind": "comment",
      "description": "As in \"casting a line and seeing what you catch\".\n\nDo not suggest another method of play, role (e.g. don't tell someone to DM when they are looking for a DM), or game system other than the ones specified in the post. You may, however, suggest a new game system if the post title includes [Flexible].\n\n[MORE INFO](https://www.reddit.com/r/lfg/wiki/index/rules)",
      "short_name": "No Fishing",
      "violation_reason": "No Fishing",
      "created_utc": 1531640054.0,
      "priority": 2,
      "description_html": "--redacted--"
    },
    {
      "kind": "all",
      "description": "In order to prevent rule breaking outside of the sub, GMs may not insist that players provide contact information first.\n\nAlso, do not post personal info: Emails, addresses, phone numbers. Exchange such information privately, if necessary. Discord handles are completely okay to share.\n\n[MORE INFO](https://www.reddit.com/r/lfg/wiki/index/rules)",
      "short_name": "Phone/Address/other contact info.",
      "violation_reason": "User is sharing their email, physical address, or phone number.",
      "created_utc": 1531640078.0,
      "priority": 3,
      "description_html": "--redacted--"
    },
    {
      "kind": "all",
      "description": "Follow reddiquette and be mindful of manners. \nIf you\u2019re being harassed, please send the mod team screenshots. What happens in sessions and outside of /r/lfg is not something we can --or will--moderate.\n\n[MORE INFO](https://www.reddit.com/r/lfg/wiki/index/rules)",
      "short_name": "Be nice",
      "violation_reason": "Be nice",
      "created_utc": 1531640098.0,
      "priority": 4,
      "description_html": "--redcated--"
    },
    {
      "kind": "all",
      "description": "If it costs something, this is probably the wrong place. Users may not solicit or offer paid games, services, or donations of any kind. This includes \"try before you buy\" or \"first one's free\" offerings. Playing on a software platform that requires a purchase or in an FLGS that charges a fee (that goes to said FLGS) is acceptable.\n\n[MORE INFO](https://www.reddit.com/r/lfg/wiki/index/rules)",
      "short_name": "No money",
      "violation_reason": "No money",
      "created_utc": 1531640145.0,
      "priority": 5,
      "description_html": "--redacted--"
    },
    {
      "kind": "link",
      "description": "Posts must include a game tag in the title and receive post flair within 5 minutes of being submitted. Posts without flair after five minutes will be eaten by Se\u00f1or Owlbear, our bot. The mods will not act to approve it as these posts are his only main food source. You will have to repost.\n\n  \n[MORE INFO](https://www.reddit.com/r/lfg/wiki/index/formatting)",
      "short_name": "Post format",
      "violation_reason": "As this rule is enforced by AutoMod, any post visible to a user is not in violation of this rule.",
      "created_utc": 1538523129.0,
      "priority": 6,
      "description_html": "--redacted--"
    },
    {
      "kind": "comment",
      "description": "Arguing, debating, or otherwise derailing an lfg post is considered harmful to our users and will be met with moderator action. Anything that does not help OP find the game for which they've posted is in violation of this rule.\n\nUse the report button to inform moderators of anything offensive. If you can, send screenshots.\n\nGenuine encouragement and positivity is allowed on all posts. Respectful commentary and debate are welcome on posts with \"Meta\" flair and in modmail.",
      "short_name": "Argument/Debate/Derailing/Negative Criticism",
      "violation_reason": "Argument/Debate/Derailing/Negative Criticism",
      "created_utc": 1580109780.0,
      "priority": 7,
      "description_html": "--redcated--"
    }
  ],

  "site_rules": {
    "kind": "ignore these"
  }
}

This could be fetched via requests and can be loaded into Rule objects by iterating over "rules" taking short_name for the name and description for the description.

seancallaway commented 1 year ago

This may not be possible due to Reddit's new API limitations.

A single requests.get('https://www.reddit.com/r/lfg.json') returns an HTTP 429 (Too many requests)

Actually, this works just fine. Just need to set the User-Agent header.