Closed hatami57 closed 6 years ago
Try it. But I do not give any guarantees :) https://stackoverflow.com/questions/37782348/how-to-use-getchats-in-tdlib
Thank you! I've tried it but it does not work :-(
For the first time I've set:
offset_order=2^63-1
, offset_chat_id=0
, limit=1
For the next time:
offset_order=(2^63-1) - 1
, offset_chat_id=<last_received_chat_id>
, limit=1
but it always returns the same chat_ids!
By the way, the getChats
method just returns a list of chat_id
s and not a pair of (order, chat_id)!
Chats are sorted in decreasing order by pairs (chat.order, chat.id) and returned in that order. To get chats from 99-th chat onward, you need to pass in getChats order and id of that chat, so the request should be
offset_order=<last_received_chat.order>, offset_chat_id=<last_received_chat.id>, limit=100
Also be aware that chats can change their order very often, so such iterative method may not work. You can find an example of a proper way of getting chat list in our Java example https://github.com/tdlib/td/blob/6c706f45e7a73c936b9f2f267785092c8a73348f/example/java/org/drinkless/tdlib/example/Example.java#L206.
Thank you!
I thought the chat
type is like telegram schema and has not order
field.
The example was useful :-)
I have try many time but getchats didn't work in python and tdjson always its send the last limit order
I've used
getChats
method withoffset_order=2^63-1
,offset_chat_id=0
andlimit=100
getChats (std::int64_t offset_order_, std::int64_t offset_chat_id_, std::int32_t limit_)
It returns first 100 chats, but when I call it again to obtain next 100 chats with
offset_order=(2^63-1) - 100
,offset_chat_id=0
andlimit=100
, it returns the first 100 chats again! I've played with many different values for these parameters but it does not work! if I startoffset_order
from0
, it does not return any thing!How should I use it to obtain all available chats in a Telegram account (even if there are thousands of chats)?