PHP Telegram Bot version: 2.2.7
Using MySQL database: no
Calling \TelegramBot\Api\Types\Message::toJson of an object with a non-empty entities filed should return a json-string
An erro Call to a member function toJson() on array
$response = [
"message_id" => 17,
"from" => [
"id" => 142775991,
"first_name" => "first name",
"last_name" => "last name",
"username" => "nickname",
],
"chat" => [
"id" => 142775991,
"first_name" => "first name",
"last_name" => "last name",
"username" => "nickname",
"type" => "private",
],
"date" => 1491068438,
"text" => "/latest",
"entities" => [
[
"type" => "bot_command",
"offset" => 0,
"length" => 7,
],
],
];
$message = \TelegramBot\Api\Types\Message::fromResponse($response);
$json = $message->toJson();
$this->$property->toJson(true) is called for a field entities which is an arrayWrong repo, mate....
ΠΠ΅ ΡΠΎΡ ΡΠ΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΠΉ - ΡΠ²ΠΎΠΉ Π±ΠΎΡ Π½Π° Π΄ΡΡΠ³ΠΎΠΌ ΡΠΊΡΠΈΠΏΡΠ΅ ΡΠΎΠ±ΡΠ°Π½...
Π‘ΠΎΡΡΠΈ, ΡΠ»ΠΈΡΠΊΠΎΠΌ ΠΌΠ½ΠΎΠ³ΠΎ Π²ΠΊΠ»Π°Π΄ΠΎΠΊ ΠΎΡΠΊΡΡΠ».

Most helpful comment