Skip to content

Conversation

@LasterAlex
Copy link
Owner

No description provided.

will-lynas and others added 29 commits November 12, 2024 08:23
It's the batch version of deleteMessage that does not return errors for
messages that were not found.

Docs: https://core.telegram.org/bots/api#deletemessages
According to the Telegram Bot API docs, the cases of the forward origins are
as follows:

* MessageOriginChannel: The message was originally sent to a channel chat.
* MessageOriginChat: The message was originally sent on behalf of a chat to a group chat.
* MessageOriginUser: The message was originally sent by a known user.
* MessageOriginHiddenUser: The message was originally sent by an unknown user.

Testing with the actual bot API, I do get users, not the chat, for messages forwarded
from a supergroup.

MessageOriginHiddenUser is determined by the user's settings, which are
not exposed to the bot API.
This is not documented properly in Telegram's API docs, but it's the
go-to way to remove the inline keyboard from a message.
Make editMessageText delete reply markup to match Telegram's behavior
* A wrapper is introduced that changes a Message's into_update() behavior.
  Having edit_date set seems to be a requirement for correct parsing.
* MockBot is updated to support UpdateKind::EditedMessage.
* Renamed the old Messages::edit_message to edit_message_field for clarity.
* I also fixed a couple of copy-paste errors along the way.
Add support for UpdateKind::EditedMessage
Editing message text to the same value is an easy mistake to make, so I
would like to test my code against it.

I would also like to receive the error properly as an ApiError enum
variant, so this commit introduces a way for teloxide_tests actions
to return standard error values of Telegram Bot API that teloxide
can actually parse.

In the future, other usages of check_if_message_exists and ErrorBadRequest
should also be replaced with ApiErrors where possible.
Make `edit_message_text` return `ApiError::MessageNotModified`
@LasterAlex LasterAlex merged commit 367b61f into master Apr 24, 2025
7 checks passed
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

Successfully merging this pull request may close these issues.

4 participants