Bernard J. Ortcutt
Full module documentation: Bernard_j_ortcutt
Bernard J. Ortcutt is a Reddit bot for assisted moderation. It is configured to watch for items that moderators have reported with special command strings and then perform pre-arranged actions corresponding to those commands.
For example, suppose we want to be able to remove links or comments when they violate a rule of a subreddit and notify the author that this has happened. We could provide the following configuration:
((info "Removed (Rule 1)")
(trigger ((commands ("rule 1")) (kinds (link comment))))
(actions (Remove (Notify (text "Please do not break rule 1")))))We can then report a link or comment with the reason "rule 1" and the bot will
- Remove the post; and
- Leave a distinguished reply asking the user not to break the rule.
Configuration
Bernard uses s-expresssions for configuration, and this documentation presupposes familiarity with ppx_sexp_conv's conventions for serializing OCaml values.
The configuration for a subreddit is simply a list of rules. Consult the Bernard_j_ortcutt.Rule.t type, as well as the Bernard_j_ortcutt.Rule.Trigger.t and Bernard_j_ortcutt.Action.t types referenced therein, for the complete structure of possible configurations.
Usage
Bernard requires three command line parameters:
-credentialsA file containing a sexp-ified
Reddit_api_async.Connection.Credentials.t.-databaseA PostgreSQL database, which can be created with the included
create_tables.sql.-subredditsA directory whose files are named
<subreddit>.sexp, where each subreddit is a subreddit that Bernard will moderate and the file contents are a series of sexp-ified rules.