How works the method getChatHistory ?
How can I use the offset function if I havelimit = 50, onlyLocal = false and fromMessageId = chat.lastMessage.Id
I want to get messages from the newest to the oldest using the offset to avoid duplicate messages
You need to specify offset = -51. TDLib currently requires offset + limit > 0 for getChatHistory, so you will usually receive 1 duplicate message.
-51 + 50 does not> 0 anyway, I can not understand why if I make a request with offset = 0 limit = 50 it works, if I do offset = -50 limit = 100 it works but if I do offset = -100 limit = 150 it does not work



Sorry, I've meant offset = -49.
Request with offset = -100 and limit = 150 doesn't work, because limit must be positive and can't be greater than 100.
so how can I get older messages?
You need to adjust from_message_id accordingly on every request.
Ahhh, ok.
Now how can I see how many messages there are in total in the channel?
This number isn't available currently in TDLib.
Most helpful comment
-51 + 50 does not> 0 anyway, I can not understand why if I make a request with offset = 0 limit = 50 it works, if I do offset = -50 limit = 100 it works but if I do offset = -100 limit = 150 it does not work