telegram-api
telegram-api copied to clipboard
How to use MessageEntity?
`<?php use \unreal4u\TelegramAPI\Telegram\Types\Update; use \React\EventLoop\Factory; use \unreal4u\TelegramAPI\HttpClientRequestHandler; use \unreal4u\TelegramAPI\TgLog; use \unreal4u\TelegramAPI\Telegram\Methods\DeleteMessage; use \unreal4u\TelegramAPI\Telegram\Methods\SendMessage; use \unreal4u\TelegramAPI\Telegram\Types\MessageEntity;
$loop = Factory::create(); $tgLog = new TgLog("**********:AAFpSHsiJiUbzOnQuscxTAqnKdeH_MXuWl8", new HttpClientRequestHandler($loop)); $updateData = json_decode(file_get_contents('php://input'), true); $update = new Update($updateData); if ($update->message->text == '/start') { $date = new MessageEntity(); $chat_id = $message->chat->id; $sm = new SendMessage(); $sm->text = json_encode($date); $sm->chat_id = $chat_id; $tgLog->performApiRequest($sm); $loop->run(); }`
{"type":"","offset":0,"length":0,"url":"","user":null}
i'm getting an empty type, but I need to get bot_command @unreal4u
Take a look at the following example for MessageEntities: https://github.com/unreal4u/telegram-bots/blob/master/src/Bots/Base.php#L408-L436