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

td_api::searchChatMessages returns incomplete vector of messages. #11

Closed
Firemoon777 opened this issue Jan 21, 2018 · 2 comments
Closed

Comments

@Firemoon777
Copy link

Firemoon777 commented Jan 21, 2018

I tried to retrieve all messages with documents by using filter searchMessagesFilterDocument.

std::int32_t offset = 0, limit = 50;
td_api::make_object<td_api::searchChatMessages>(id_, "", 0, 0, offset, limit, std::move(filter))

I have response of type object_ptr< messages > in callback
response->total_count_ equals to 5 (it's correct, I checked with Telegram Desktop), but response->messages.size() equals to 1 and contains only newest message with document from chat.
I tried to change limit/offset, but no luck.
How can I retrieve all messages with documents?

@levlam
Copy link
Contributor

levlam commented Jan 21, 2018

It is desired (and documented) behavior. From the parameter limit description: "Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached".
In order to get more messages, you should call again searchChatMessages with from_message_id equal to message identifier of the last received message.
Offset should be always 0, if you retrieving messages from oldest to newest.

@Firemoon777
Copy link
Author

It was a bit confusing. I figured it out, thanks!

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

2 participants