• Почему Telegram bot API метод answerCallbackQuery не показывает алерт?

    @Evgeniy1622
    maximw, Помогите пожалуйста разобраться в чем решение. Неделю не могу получить callbackquery на этой библиотеке https://github.com/php-telegram-bot/core.

    файл CallbackqueryCommand.php
    <?php
    
    /**
     * This file is part of the PHP Telegram Bot example-bot package.
     * https://github.com/php-telegram-bot/example-bot/
     *
     * (c) PHP Telegram Bot Team
     *
     * For the full copyright and license information, please view the LICENSE
     * file that was distributed with this source code.
     */
    
    namespace Longman\TelegramBot\Commands\SystemCommand;
    
    /**
     * User "/inlinekeyboard" command
     *
     * Display an inline keyboard with a few buttons.
     *
     * This command requires CallbackqueryCommand to work!
     *
     * @see CallbackqueryCommand.php
     */
    
    use Longman\TelegramBot\Commands\SystemCommand;
    use Longman\TelegramBot\Entities\InlineKeyboard;
    use Longman\TelegramBot\Entities\ServerResponse;
    use Longman\TelegramBot\Exception\TelegramException;
    
    
    class InlinekeyboardCommand extends SystemCommand
    {
        /**
         * @var string
         */
        protected $name = 'inlinekeyboard';
    
        /**
         * @var string
         */
        protected $description = 'Show inline keyboard';
    
        /**
         * @var string
         */
        protected $usage = '/inlinekeyboard';
    
        /**
         * @var string
         */
        protected $version = '1.2.0';
    
        /**
         * Main command execution
         *
         * @return ServerResponse
         * @throws TelegramException
         */
        public function execute(): ServerResponse
        {
            $inline_keyboard = new InlineKeyboard( [
                ['text' => 'Callback', 'callback_data' => 'identifier'],
                
            ]);
            
             
            return $this->replyToChat('Inline Keyboard', [
                'reply_markup' => $inline_keyboard,
            ]);
        }
    }


    файл CallbackqueryCommand.php
    <?php
    
    /**
     * This file is part of the PHP Telegram Bot example-bot package.
     * https://github.com/php-telegram-bot/example-bot/
     *
     * (c) PHP Telegram Bot Team
     *
     * For the full copyright and license information, please view the LICENSE
     * file that was distributed with this source code.
     */
    
    /**
     * Callback query command
     *
     * This command handles all callback queries sent via inline keyboard buttons.
     *
     * @see InlinekeyboardCommand.php
     */
    
    namespace Longman\TelegramBot\Commands\SystemCommands;
    
    use Longman\TelegramBot\Commands\SystemCommand;
    use Longman\TelegramBot\Entities\ServerResponse;
    use Longman\TelegramBot\Entities\CallbackQuery;
    
    class CallbackqueryCommand extends SystemCommand
    {
        /**
         * @var string
         */
        protected $name = 'callbackquery';
    
        /**
         * @var string
         */
        protected $description = 'Handle the callback query';
    
        /**
         * @var string
         */
        protected $version = '1.2.0';
    
        /**
         * Main command execution
         *
         * @return ServerResponse
         * @throws \Exception
         */
        public function execute(): ServerResponse
        {
           // Callback query data can be fetched and handled accordingly.
            $callback_query = $this->getMessagey();
            $callback_data  = $callback_query->getMessage();
    
            return $callback_query->answer([
                'text'       => 'Content of the callback data: ' . $callback_data,
                'show_alert' => (bool) random_int(0, 1), // Randomly show (or not) as an alert.
                'cache_time' => 5,
            ]);
    
    
          
    }}