In depth Chat Executor guide & entry examples
Introduction
The Intelligent Chat Executor & Modifier module modifies and or performs actions triggered by defined messages/commands using simple or complex matching techniques. It also optionally supports execution of sign text and anvil renames. It is one of the more complex modules to configure well, but this guide is here to show some examples and help!
Entry structure
Entries use the following format:
These 3 nodes can be heavily customized to fit various needs:
'match:' nodes:
Match nodes determine the message or pattern to find in chat or commands.
You can prefix/start 'match:' nodes with:
{only_commands}
to only run the match on commands{only_chat}
to only run the match on chat{only_anvils}
to run the entry on anvil renames (if the anvil listener is enabled in config.yml){only_signs}
to run the entry on sign text (if the sign listener is enabled in config.yml)
If you use neither only_chat or only_commands it will match both chat and commands. When using only_anvils or only_signs the entry will solely execute on anvils or signs
You can also add:
{text}
to specify that the match is just plain text and is not regex{regex}
to specify that the match is using regex
If you use neither, plain text will be defaulted to
A handy regex cheat sheet can be found here: https://medium.com/factory-mind/regex-tutorial-a-simple-cheatsheet-by-examples-649dc1c3f285
Node examples
match: {text}{only_commands}/plugins
will match only the command "/plugins"
match: {regex}([123])
will match any messages in chat or commands containing the characters 1, 2, or 3
On regex matches, make sure you escape any regex symbols you want there as regular text by adding a "\" to the start of any of these: <([{^\-=$!|]})?*+.>
'set-matches-as:' nodes:
Set matches as nodes determine what to set the matched text to
Any text you type after the node will be what the matched text will be set to, however if you don't want to set the matched chat message to anything you can use one of the following:
{dont_modify}
to not modify the players message at all, but still send it.{block}
to block the players message entirely.{dont_notify}
to not send any admin notifier message when matched (if admin notifications are enabled for the Chat Executor){dont_log}
to not log anything the when the entry is triggered (if logging is enabled for the Chat Executor)
These are stackable, ex. "{block}{dont_modify}{dont_log}
" however, {dont_modify}
and {block}
must not be in the same set-as node as they conflict.
'execute:' action lists:
Execute action lists determine the actions to execute when this entry is matched
To have no actions, set to "execute: []"
To set the type of action, you must prefix/start the action with:
{player_msg}:
to send a message to the player.{console_cmd}:
to run a command as the console.{player_cmd}:
to run a command as the player.{broadcast}:
to broadcast a message to all players.
To use parts of the players message in actions, you can use:
{arg<number>}
to get the word/argument of the players message (starting from 0)ex
{arg1}
in "FirstWord SecondWord ThirdWord" is "FirstWord",{arg2}
is "SecondWord", etc.
{multiargs<number>}
to get all the arguments/words after a particular argument/word.ex
{multiargs2}
of "FirstWord SecondWord ThirdWord FourthWord" is "ThirdWord FourthWord"
You can use multiple {arg<number>}
and {multiarg<number>}
placeholders in actions. If the requested argument/word is not present, it will simply be blank.
To get the players username or displayname in actions, you can use:
{PLAYER}
to get the players username.{PLAYER_DISPLAYNAME}
to get the players display name with its original colors{PLAYER_DISPLAYNAME_STRIPPED}
to get the players display name stripped of its original colors
Action examples
The above broadcasts, "Hi" followed by the player who triggered the entries username, and then broadcasts the first word of their message that triggered the entry.
The above runs the command: "tell" followed by the player who triggered the entries username, followed by "this is from the console!"
Entry examples
1 - Detect a question and answer it privately
The below example detects numerous variations of players asking for staff, blocks it, and tells them staff applications are closed. The match is regex, so it is prefixed with {regex}. Regex groups are specified with (), and sections of groups are separated by |
The below detects the following, but is not limited to:
"can I apply for staff?"
"could I have admin?"
"I want to apply"
2 - Auto reply globally to a question
You can use a similar setup as above to answer commonly asked server questions. The below match is using regex, so it is prefixed with {regex}. It's also prefixed with {only-chat} to ensure this match is only effective in global chat and not commands.
3 - Modify a message but execute no actions
The below example tries to match variations of players saying the server is bad, and modifies their message to say it's good. The below match is using regex, so it is prefixed with {regex}.
4 - Custom command outputs
You can get creative and create custom message outputs for commands, even if the player doesn't have access to it. The below example will show the player msg content to players who type /op. The regex expression will match only commands that are exactly /plugins or /pl
5 - Match only an exact chat message
Matching an exact chat message (excluding character case) and not text contained in the chat message is easy with regex, just use the following:
{regex}^exact text here$
{regex}^(exact phrase 1|exact phrase 2)$
Example:
6 - Use parts of the players message in execute actions
The below utilizes the multiargs placeholder to get all words after the 2nd word (after "repeat me:")
The below utilizes the multiargs placeholder and the arg placeholder to get all words, and get the 8th word (after "repeat only the first word I type:")
The below utilizes multiple arg placeholders to get different words from the matched message
Last updated