Closed rufatagayev closed 1 year ago
The behavior is intended. See https://core.telegram.org/tdlib/getting-started#getting-chat-messages for more details. Also, note that for optimal performance, the number of returned messages is chosen by TDLib, so app must repeat the request with adjusted from_message_id
if appropriate.
I'm trying to fetch the list of messages from a chat and this is what is happening (I'm using Kotlin):
This code returns all messages except the last one:
client?.send(TdApi.GetChatHistory(chat.id, chat.lastMessage?.id!!, 0, 100, false)) {}
These lines all return only the last message:
client?.send(TdApi.GetChatHistory(chat.id, chat.lastMessage?.id!!, -1, 100, false)) {}
client?.send(TdApi.GetChatHistory(chat.id, 0, 0, 100, false)) {}
client?.send(TdApi.GetChatHistory(chat.id, 0, -99, 100, false)) {}
client?.send(TdApi.GetChatHistory(chat.id, 0, -1, 100, false)) {}
What is going on here? Is this a bug? Or is there a way I can get all messages including the last one?