Closed linbis closed 7 years ago
Check API editMessageText docs and corresponding Request::editMesageText method
Can someone tell, in what way I can edit message text? or in 0.38.1 I can't do this?
Example usage:
<?php
namespace Longman\TelegramBot\Commands\UserCommands;
use Longman\TelegramBot\Commands\UserCommand;
use Longman\TelegramBot\Request;
class TestCommand extends UserCommand
{
public function execute()
{
$message = $this->getMessage();
$data = [
'chat_id' => $message->getChat()->getId(),
'text' => 'This message will be edited!'
];
$result = Request::sendMessage($data);
if ($result->isOk()) {
$data = [
'chat_id' => $message->getChat()->getId(),
'message_id' => $result->getResult()->getMessageId(),
'text' => 'This message was edited.'
];
Request::editMessageText($data);
} else {
Request::emptyResponse();
}
}
}
thank you! and last question - if I need edit message after inlinebutton pressed, I must send empty answerCallbackQuery and then editMessageText like in your example?
That'll work
ok, thank you very much!
Expected behaviour
When I call a callback_data on InlineKeyboardButton I have to edit previous chat message
Actual behaviour
If uncommented
message
chatting a new message. If uncommentededited_message
nothing happensSteps to reproduce
Command class
CallbackqueryCommand.php