-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Notifier] Add support for editing Telegram messages #47956
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
Conversation
@@ -98,7 +100,7 @@ protected function doSend(MessageInterface $message): SentMessage | |||
if (200 !== $statusCode) { | |||
$result = $response->toArray(false); | |||
|
|||
throw new TransportException('Unable to post the Telegram message: '.$result['description'].sprintf(' (code %s).', $result['error_code']), $response); | |||
throw new TransportException('Unable to post the Telegram message: '.$result['description'].sprintf(' (code "%s").', $result['error_code']), $response); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use post and edit accordingly?
@@ -98,7 +100,7 @@ protected function doSend(MessageInterface $message): SentMessage | |||
if (200 !== $statusCode) { | |||
$result = $response->toArray(false); | |||
|
|||
throw new TransportException('Unable to post the Telegram message: '.$result['description'].sprintf(' (code %s).', $result['error_code']), $response); | |||
throw new TransportException('Unable to post the Telegram message: '.$result['description'].sprintf(' (code "%s").', $result['error_code']), $response); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw new TransportException('Unable to post the Telegram message: '.$result['description'].sprintf(' (code "%s").', $result['error_code']), $response); | |
throw new TransportException('Unable to post the Telegram message: '.$result['description'].sprintf(' (code %d).', $result['error_code']), $response); |
@@ -98,7 +100,8 @@ protected function doSend(MessageInterface $message): SentMessage | |||
if (200 !== $statusCode) { | |||
$result = $response->toArray(false); | |||
|
|||
throw new TransportException('Unable to post the Telegram message: '.$result['description'].sprintf(' (code %s).', $result['error_code']), $response); | |||
$verb = isset($options['message_id']) ? 'edit' : 'post'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove this temp var.
Thank you @chr-hertel. |
Really fast, thanks a lot! :) |
As always 🤷🏼♂️ 😁 |
Telegram supports updating messages which is quite a use case while working with buttons to create an interactive inline interface.
See https://core.telegram.org/bots/api#editmessagetext