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

editMessage #913

Closed
glebkhil opened this issue Jan 12, 2022 · 3 comments
Closed

editMessage #913

glebkhil opened this issue Jan 12, 2022 · 3 comments

Comments

@glebkhil
Copy link

how can i editMessage? can you give sample?

@marechenok
Copy link

Most often I have to do this during callback processing. Then I use something like this:

use Telegram\Bot\Objects\Update;
class CallbackHandler {
  public static function handle(Update $update){
          $message = $update->getMessage();
          $chat = $message->get('chat');
          Telegram::editMessageText([
                      'chat_id'   => $chat->get('id'),
                      'message_id'    =>  $message->get('message_id'),
                      'text'  =>  "updated text",
                  ]);
  }
}

@asteriskDevelop
Copy link

Next Telegram\Bot\Exceptions\TelegramResponseException: Bad Request: message text is empty in /var/www/admin/data/www/.site/vendor/irazasyed/telegram-bot-sdk/src/Exceptions/TelegramResponseException.php:67
Stack trace:
#0 /var/www/admin/data/www/.site/vendor/irazasyed/telegram-bot-sdk/src/TelegramResponse.php(101): Telegram\Bot\Exceptions\TelegramResponseException::create(Object(Telegram\Bot\TelegramResponse))
#1 /var/www/admin/data/www/.site/vendor/irazasyed/telegram-bot-sdk/src/TelegramResponse.php(82): Telegram\Bot\TelegramResponse->makeException()
#2 /var/www/admin/data/www/.site/vendor/irazasyed/telegram-bot-sdk/src/TelegramResponse.php(52): Telegram\Bot\TelegramResponse->decodeBody()
#3 /var/www/admin/data/www/.site/vendor/irazasyed/telegram-bot-sdk/src/TelegramClient.php(130): Telegram\Bot\TelegramResponse->__construct(Object(Telegram\Bot\TelegramRequest), Object(GuzzleHttp\Psr7\Response))
#4 /var/www/admin/data/www/.site/vendor/irazasyed/telegram-bot-sdk/src/TelegramClient.php(82): Telegram\Bot\TelegramClient->getResponse(Object(Telegram\Bot\TelegramRequest), Object(GuzzleHttp\Psr7\Response))
#5 /var/www/admin/data/www/.site/vendor/irazasyed/telegram-bot-sdk/src/Traits/Http.php(305): Telegram\Bot\TelegramClient->sendRequest(Object(Telegram\Bot\TelegramRequest))
#6 /var/www/admin/data/www/.site/vendor/irazasyed/telegram-bot-sdk/src/Traits/Http.php(198): Telegram\Bot\Api->sendRequest('POST', 'editMessageText', Array)
#7 /var/www/admin/data/www/.site/vendor/irazasyed/telegram-bot-sdk/src/Methods/EditMessage.php(52): Telegram\Bot\Api->post('editMessageText', Array)
#8 /var/www/admin/data/www/.site/bot.php(205): Telegram\Bot\Api->editMessageText(Array)
#9 {main}
thrown in /var/www/admin/data/www/.site/vendor/irazasyed/telegram-bot-sdk/src/Exceptions/TelegramResponseException.php on line 67

@SoulNaturalist
Copy link

@MaxMCP your text is empty, give code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants