Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use MessageEntity? #131

Open
tilonuz99 opened this issue Dec 29, 2020 · 2 comments
Open

How to use MessageEntity? #131

tilonuz99 opened this issue Dec 29, 2020 · 2 comments
Labels
question Marks an PR or issue to be a question rather than code modification

Comments

@tilonuz99
Copy link

tilonuz99 commented Dec 29, 2020

`<?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

@unreal4u unreal4u added the question Marks an PR or issue to be a question rather than code modification label Jun 7, 2021
@unreal4u
Copy link
Owner

unreal4u commented Jun 7, 2021

Take a look at the following example for MessageEntities: https://github.com/unreal4u/telegram-bots/blob/master/src/Bots/Base.php#L408-L436

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Marks an PR or issue to be a question rather than code modification
Projects
None yet
Development

No branches or pull requests

3 participants
@unreal4u @tilonuz99 and others