{"id":20191462,"url":"https://github.com/leviroth/bernard","last_synced_at":"2025-03-03T07:41:11.233Z","repository":{"id":52624633,"uuid":"78885296","full_name":"leviroth/bernard","owner":"leviroth","description":"Automate reddit moderation through reports","archived":false,"fork":false,"pushed_at":"2021-04-22T23:11:10.000Z","size":304,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-13T18:52:50.370Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leviroth.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-13T20:46:26.000Z","updated_at":"2022-08-09T21:48:24.000Z","dependencies_parsed_at":"2022-08-27T00:11:33.450Z","dependency_job_id":null,"html_url":"https://github.com/leviroth/bernard","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leviroth%2Fbernard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leviroth%2Fbernard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leviroth%2Fbernard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leviroth%2Fbernard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leviroth","download_url":"https://codeload.github.com/leviroth/bernard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241629736,"owners_count":19993707,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T03:49:17.700Z","updated_at":"2025-03-03T07:41:11.202Z","avatar_url":"https://github.com/leviroth.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Synopsis ##\n\nBernard J. Ortcutt is a Reddit moderation bot. Moderators send it commands by\nreporting posts or comments. The bot reads these commands and automates\nmoderation, based on a customizable configuration.\n\n## Setup ##\n\nYou can install the latest development version with:\n\n    pip install https://github.com/leviroth/bernard/archive/master.zip\n\nYour subreddit must be configured\nfor [toolbox's](https://github.com/creesch/reddit-moderator-toolbox/) usernotes\nmodule, or else the built-in commands will fail.\n\nThe database should be set up by reading `create_tables.sql` with SQLite3, as\nin:\n\n    sqlite3 bernard-database.sq3 \".read create_tables.sql\"\n\nThe bot requires `access`, `config`, `posts,` and `wiki` permissions. While not\nstrictly necessary, `mail` permissions keep replies to ban messages from going\nto your bot's inbox. That makes it easier to isolate the messages sent to your\nbot, which would be missed otherwise and which are very occasionally useful.\n\nLogin information should be configured with\na\n[praw.ini file](http://praw.readthedocs.io/en/latest/getting_started/configuration/prawini.html).\n\n## Usage ##\n\n    python -m bernard [config_directory] [database]\n\n## Configuration ##\n\nThe bot is configured via YAML files, one per subreddit. You can find an example\nfile in the `examples/` directory; given a directory containing the file\n`thirdrealm.yaml`, the bot loads a configuration for the subreddit\n`/r/ThirdRealm`.\n\nA configuration file consists of a series of YAML documents, each one generating\na rule.\n\nA rule configuration is a dictionary with three keys: `info`, `trigger`, and\n`actions`.\n\n### `info` configuration ###\n\nSample:\n\n```yaml\ninfo:\n  name: Removed\n  details: Question\n```\n\nThe `info` block accepts `name` and `details` strings that summarize the rule.\n\n### `trigger` configuration ###\n\nSample:\n\n```yaml\ntrigger:\n  commands:\n  - question\n  - q\n  types:\n  - post\n```\n\nThe `trigger` block accepts a list of `commands`, which are strings that match\nreports, and `types`, a list that can contain `post` and/or `comment`. In this\nexample, any post (but not comment) that is reported with the strings `question`\nor `q` will be targeted for the action.\n\n## `actions` configuration ##\n\nSample:\n\n```yaml\nactions:\n- remove\n- notify:\n    text: 'Questions are best directed to /r/askphilosophy,  which specializes in\n      answers to philosophical questions!'\n- usernote:\n    level: abusewarn\n    text: Removed (question)\n```\n\nThe `actions` block contains a list of action configurations. An action\nconfiguration is either the name of an action, or else a dictionary wherein the\nkey is the name of the action and the value is a dictionary of parameters. The\nparameters vary according to action, as described in the following section. If\nthe action is given as a string, then the parameters default to empty.\n\nIn this example, our rule performs three actions. The post is removed, a\nnotification is added explaining the removal, and a Reddit Moderator Toolbox\nusernote is added to the submitter.\n\n## Actions ##\n\nBernard understands the following basic actions, which can be composed into more\ncomplex actions via a configuration file. A *target* can be a comment or a\nsubmission.\n\n### Removing targets ###\n\nSet via the `remove` configuration key. Please note that the target is approved\notherwise; this is necessary to prevent repeat actions.\n\nA submission that is removed is locked.\n\n### Notifying authors ###\n\nVia a comment, distinguished as a moderator. This comment is stickied if the\ntarget is a submission.\n\n### Automod update ###\n\nAdds the author's username and/or post's domain to a list in the AutoModerator\nconfiguration. This requires that the list include a placeholder name. I put\nexclamation marks in my placeholders to ensure that they can't match a valid\nusername.\n\n*Example uses*: Automatically report a problem user's comments for review;\nautomatically flair posts by bots or other specific-purpose accounts;\nautomatically remove spam domains.\n\n### Ban authors ###\n\nBans the author from the subreddit. Can set a duration, but only on a fixed\nper-command basis. That is, it isn't currently possible to make a report-command\ntake duration as a parameter. If no duration is set, the ban is permanent.\n\n### Nuke replies ###\n\nRemoves all descendants from the comment tree. Does not affect the target; use\nthe `remove` key if it should be removed. Does not affect distinguished comments.\n\nCurrently only works for comment targets.\n\n### Add toolbox usernote ###\n\nAdds a usernote for the author.\n\n## Logging ##\n\nBernard logs its actions to a\ndatabase. [bernard-logs](https://github.com/leviroth/bernard-logs) is a simple\nFlask app providing a web-based view for these logs. reddit's OAuth is used for\nlogin: a user can view the logs of a specific subreddit if and only if she is a\nmoderator of that subreddit.\n\n## Namesake ##\n\nBernard J. Ortcutt is a character who appears in W. V. Quine's classic paper\n\"Quantifiers and Propositional Attitudes.\" This doesn't have anything to do with\nwhat the bot does; I was just reading the paper back when I began this project,\nand I needed a name.\n\n## License ##\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleviroth%2Fbernard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleviroth%2Fbernard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleviroth%2Fbernard/lists"}