From e6f32d795cef3c8deaaf28e139301cb8c00e6a60 Mon Sep 17 00:00:00 2001 From: Noikoio Date: Fri, 27 Oct 2017 19:25:02 -0700 Subject: [PATCH] Completed AutoMod documentation And slight adjustment in EntityList documentation --- docs/docs/automod.md | 37 ++++++++++++++++++++++++++----------- docs/docs/entitylist.md | 2 +- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/docs/docs/automod.md b/docs/docs/automod.md index bd104b8..ed717e7 100644 --- a/docs/docs/automod.md +++ b/docs/docs/automod.md @@ -1,35 +1,50 @@ ## AutoMod -AutoMod takes some inspiration from Reddit's [Automoderator](https://www.reddit.com/wiki/automoderator). It allows the user to define one or more *rules* based on regular expression (regex) patterns, in order for the bot to execute a *response* when triggered. This was initially the main and only feature of this bot, hence the name RegexBot. +AutoMod is a component that takes inspiration from Reddit's [Automoderator](https://www.reddit.com/wiki/automoderator). It allows the user to define one or more *rules* based on regular expression (regex) patterns. When the rule is matched, the bot will proceed to to execute a *response*. This was initially the main and only feature of this bot, hence its name RegexBot. -AutoMod rules are defined per-server within an object named `automod`. Each rule is defined as a name/value pair, with the name serving as its label. +AutoMod rules are defined per-server within the `automod` object. Each rule is defined as a name/value pair, with the name serving as its label. Sample AutoMod rules: ``` "Delete bilingual pirates": { "regex": [ "pira(te|cy)", "pirat(a|erĂ­a)", ], - "response": "delete" + "response": [ + "delete" + "report #0000000::mod-queue" + ] }, "Selective trigger": { "regex": "secret", - "response: [ - "delete", - "say #_ Don't say the s word, @_!" - ], + "response: "say #_ Don't say the s word, @_!", whitelist: { "channels": [ "#dont-say-secret" ] } } ``` -### Rules +### Rule structure The following is a list of accepted members within an AutoMod rule: * regex (*string* or *string array*) - **Required.** Regular expression pattern(s) that trigger the defined rule. * response (*string* or *string array*) - **Required.** Response, or list of responses to execute. * See the section below for more information on responses. * whitelist *[(entity list)](entitylist.html)* - Entities to which the rule exclusively applies to. * blacklist *[(entity list)](entitylist.html)* - Entities to which the rule does not apply to. -* exempt *[(entity list)](entitylist.html)* - Entities which are exempt from the whitelist or blacklist rules. - * For example: If a particular role is blocked from triggering the rule, you may add an exemption for a single user within that role to be able to trigger the rule. +* exempt *[(entity list)](entitylist.html)* - Entities which are exempt from whitelist or blacklist rules. + * For example: It would allow for a specific user to trigger a rule, despite being a member of a blocked role. * AllowModBypass *(boolean)* - Specifies if those defined within the *moderators* list for the server should be exempt from triggering this rule. Defaults to *true*. ### Responses -(to be written later) \ No newline at end of file +Responses are the actions executed when a rule is matched. They take the form of one or more strings defined within a single rule. Defining a response could be considered to be similar to typing out a command, with particular responses requiring a number of parameters. + +The following responses are currently implemented: +* ban - Immediately bans the user that triggered the rule. +* kick - Immediately kicks the user that triggered the rule. +* remove - Removes the message that triggered the rule. + * Aliases: delete +* report *target_entity* - Sends a copy of the message that triggered the rule to the specified *target*. +* grantrole *target_user* *role_ID* - Adds the *target_user* to the given role defined by *role_ID*. + * Aliases: addrole +* revokerole *target_user* *role_ID* - Removes the *target_user* from the given role defined by *role_ID*. + * Aliases: delrole, removerole +* say *target_entity* *message* - Sends *message* to the given *target_entity*. + * Aliases: send + +For responses that support parameters, it is possible to specify the matching user or the channel in which the match occurred as a parameter. This is done using `@_` and `#_`, respectively. Additionally it is possible to define a user or channel in the same way as items in an entity list, by using either the entity's ID, name, or both. \ No newline at end of file diff --git a/docs/docs/entitylist.md b/docs/docs/entitylist.md index b73b106..24e2f48 100644 --- a/docs/docs/entitylist.md +++ b/docs/docs/entitylist.md @@ -2,7 +2,7 @@ An entity list is a JSON object with multiple values each containing arrays of strings. They are used in various places in the configuration to specify a number of users, roles, channels, or any combination thereof. -Here is a sample of an entity list: +The following is a sample of an entity list: ``` { "users": [ "@000000000000::MyName", "That Guy Over There" ],