|
| __construct (string $regex_rule, callable $script) |
| Add a function that will be executed everytime a message contain a command that match the regular expression. More...
|
|
bool | checkCommand (array $message) |
|
Public Member Functions inherited from PhpBotFramework\Commands\BasicCommand |
callable | getScript () |
|
◆ __construct()
PhpBotFramework\Commands\MessageRegexCommand::__construct |
( |
string |
$regex_rule, |
|
|
callable |
$script |
|
) |
| |
Add a function that will be executed everytime a message contain a command that match the regular expression.
Use this syntax:
addMessageCommandRegex("number\d", function($bot, $message, $result) {
$bot->sendMessage("You sent me a number"); });
- Parameters
-
string | $regex_rule | Regex rule that will called for evalueting the command received. |
callable | $script | The function that will be triggered by a command. Must take an object(the bot) and an array(the message received). |
The documentation for this class was generated from the following file:
- src/Commands/MessageRegexCommand.php