getMessage(); $chat_id = $message->getChat()->getId(); $reply_to_message = $message->getReplyToMessage(); $text = $message->getText(true); if ($reply_to_message && $message_to_edit = $reply_to_message->getMessageId()) { // Try to edit the selected message. $result = Request::editMessageText([ 'chat_id' => $chat_id, 'message_id' => $message_to_edit, 'text' => $text ?: 'Edited message', ]); // If successful, delete this editing reply message. if ($result->isOk()) { Request::deleteMessage([ 'chat_id' => $chat_id, 'message_id' => $message->getMessageId(), ]); } return $result; } return $this->replyToChat(sprintf("Reply to any bots' message and use /%s to edit it.", $this->getName())); } }