Closed sergix44 closed 4 years ago
Solved. We had seen the comment on the previous issue and we were already working on it, anyway, you did well creating a new issue. The fix was published within the 0.4.2 release.
Note: your call will fail anyway because editMessageText
requires a chat_id and a message_id to be passed.
Actually should works, if is inline_message_id is specified those two are optional https://core.telegram.org/bots/api#editmessagetext
Ah you're right, maybe the framework could set the inline_message_id by itself (retrieving it from $update->getCallbackQuery()->getInlineMessageId()
) if the user doesn't provide one. So, the user instead of doing:
$bot->onCbQueryData(['stop'], function (Context $ctx) {
$ctx->editMessageText('Canceled', ['inline_message_id' => $ctx->getCallbackQuery()->getInlineMessageId()]);
});
can just do:
$bot->onCbQueryData(['stop'], function (Context $ctx) {
$ctx->editMessageText('Canceled');
});
What do you think?
Ye sure, will reduce some boilerplate
There is also another issue i've found out, related to the update method, it seems is not possible to update a message outside the callback context with the latest update:
$bot->getTelegram()->editMessageText('another message', [
'inline_message_id' => $inlineMessageId
]);
It give and error that the update is null (obviously). I think that the framework should not try to set the vars outside the update context, and delegate to the dev instead (or check if the updated is set or not).
Yes, I agree. We've released a 0.4.3 with this check. Then we've implemented what we said here, extending the behaviour also for editMessageLiveLocation, stopMessageLiveLocation, editMessageCaption, editMessageMedia, editMessageReplyMarkup, setGameScore, getGameHighScores
methods.
Yes, I agree. We've released a 0.4.3 with this check. Then we've implemented what we said here, extending the behaviour also for
editMessageLiveLocation, stopMessageLiveLocation, editMessageCaption, editMessageMedia, editMessageReplyMarkup, setGameScore, getGameHighScores
methods.
I've tested, the fix works for outside context, but with the inline_message_id
is not working, I still need to specified it.
I accidentally removed an import, fixed it (059b468). Released 0.4.4 version.
A similar issue to the #4 is given when trying to edit the message produced by an inline request, for example:
Produces:
(Sorry for the iterative report, but without the previous fix i couldn't find this problem)