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

Public Member Functions

 __construct (string $data, callable $script)
 Add a function that will be executed everytime a callback query contains a string as data. More...
 
bool checkCommand (array $callback_query)
 (Internal) Process the callback query and check if it triggers a command of this type. More...
 
- Public Member Functions inherited from PhpBotFramework\Commands\BasicCommand
callable getScript ()
 

Static Public Attributes

static $type = 'callback_query'
 
static $object_class = 'PhpBotFramework\Entities\CallbackQuery'
 
static $priority = 1
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ __construct()

PhpBotFramework\Commands\CallbackCommand::__construct ( string  $data,
callable  $script 
)

Add a function that will be executed everytime a callback query contains a string as data.

Use this syntax:

addMessageCommand("menu", function($bot, $callback_query) {
    $bot->editMessageText($callback_query['message']['message_id'], "This is the menu"); });
Parameters
string$dataThe string that will trigger this function.
callable$scriptThe function that will be triggered by the callback query if it contains the $data string. Must take an object(the bot) and an array(the callback query received).

Member Function Documentation

◆ checkCommand()

bool PhpBotFramework\Commands\CallbackCommand::checkCommand ( array  $callback_query)

(Internal) Process the callback query and check if it triggers a command of this type.

Parameters
array$callback_queryCallback query to process.
Returns
bool True if the callback query triggered a command.

The documentation for this class was generated from the following file: