for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Longman\TelegramBot\Commands\SystemCommands;
use Longman\TelegramBot\Commands\SystemCommand;
use Longman\TelegramBot\Request;
* Callback query command
class CallbackqueryCommand extends SystemCommand
{
* @var callable[]
protected static $callbacks = [];
* @var string
protected $name = 'callbackquery';
protected $description = 'Reply to callback query';
protected $version = '1.0.0';
* Command execute method
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
public function execute()
//$callback_query = $this->getUpdate()->getCallbackQuery();
//$user_id = $callback_query->getFrom()->getId();
//$query_id = $callback_query->getId();
//$query_data = $callback_query->getData();
// Call all registered callbacks.
foreach (self::$callbacks as $callback) {
$callback($this->getUpdate()->getCallbackQuery());
}
return Request::answerCallbackQuery(['callback_query_id' => $this->getUpdate()->getCallbackQuery()->getId()]);
* Add a new callback handler for callback queries.
* @param $callback
public static function addCallbackHandler($callback)
self::$callbacks[] = $callback;