PhpBotFramework  2.0.2
A framework for Telegram Bots' APIs.
Public Member Functions | List of all members
PhpBotFramework\Commands\MessageRegexCommand Class Reference
Inheritance diagram for PhpBotFramework\Commands\MessageRegexCommand:
PhpBotFramework\Commands\BasicCommand

Public Member Functions

 __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 ()
 

Additional Inherited Members

- Protected Attributes inherited from PhpBotFramework\Commands\BasicCommand
 $script
 

Constructor & Destructor Documentation

◆ __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_ruleRegex rule that will called for evalueting the command received.
callable$scriptThe 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: