Completed AutoMod documentation
And slight adjustment in EntityList documentation
This commit is contained in:
parent
b12cbe8ce2
commit
e6f32d795c
2 changed files with 27 additions and 12 deletions
|
@ -1,35 +1,50 @@
|
||||||
## AutoMod
|
## 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:
|
Sample AutoMod rules:
|
||||||
```
|
```
|
||||||
"Delete bilingual pirates": {
|
"Delete bilingual pirates": {
|
||||||
"regex": [ "pira(te|cy)", "pirat(a|ería)", ],
|
"regex": [ "pira(te|cy)", "pirat(a|ería)", ],
|
||||||
"response": "delete"
|
"response": [
|
||||||
|
"delete"
|
||||||
|
"report #0000000::mod-queue"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"Selective trigger": {
|
"Selective trigger": {
|
||||||
"regex": "secret",
|
"regex": "secret",
|
||||||
"response: [
|
"response: "say #_ Don't say the s word, @_!",
|
||||||
"delete",
|
|
||||||
"say #_ Don't say the s word, @_!"
|
|
||||||
],
|
|
||||||
whitelist: { "channels": [ "#dont-say-secret" ] }
|
whitelist: { "channels": [ "#dont-say-secret" ] }
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Rules
|
### Rule structure
|
||||||
The following is a list of accepted members within an AutoMod rule:
|
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.
|
* 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.
|
* response (*string* or *string array*) - **Required.** Response, or list of responses to execute.
|
||||||
* See the section below for more information on responses.
|
* See the section below for more information on responses.
|
||||||
* whitelist *[(entity list)](entitylist.html)* - Entities to which the rule exclusively applies to.
|
* 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.
|
* 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.
|
* exempt *[(entity list)](entitylist.html)* - Entities which are exempt from 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.
|
* 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*.
|
* AllowModBypass *(boolean)* - Specifies if those defined within the *moderators* list for the server should be exempt from triggering this rule. Defaults to *true*.
|
||||||
|
|
||||||
### Responses
|
### Responses
|
||||||
(to be written later)
|
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.
|
|
@ -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.
|
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" ],
|
"users": [ "@000000000000::MyName", "That Guy Over There" ],
|
||||||
|
|
Loading…
Reference in a new issue