Closed vesh95 closed 1 year ago
telegram-bot/api php 8.2
try { $client = new Client($this->botKey); $client->on(function (Update $update) use ($client) { $message = $update->getMessage(); }, fn() => true); $client->run(); } catch (InvalidJsonException $e) { return $e->getCode(); }
Трейс:
2023-01-07T17:13:26.237520343Z Fatal error: Uncaught TelegramBot\Api\InvalidJsonException: Syntax error in /app/vendor/telegram-bot/api/src/BotApi.php:304 2023-01-07T17:13:26.237525022Z Stack trace: 2023-01-07T17:13:26.237526356Z #0 /app/vendor/telegram-bot/api/src/Client.php(141): TelegramBot\Api\BotApi::jsonValidate('', true) *** *** 2023-01-07T17:13:26.237530419Z #3 {main} 2023-01-07T17:13:26.237531568Z thrown in /app/vendor/telegram-bot/api/src/BotApi.php on line 304
It's a webhook and it must be called by telegram itself. $client->run() method expects php://input contains data from telegram
$client->run()
php://input
telegram-bot/api php 8.2
Трейс: