tgl icon indicating copy to clipboard operation
tgl copied to clipboard

Getting entire history of a chat

Open Shikib opened this issue 9 years ago • 2 comments

I'm trying to get the entire history of a chat, and I was using a lua script to write to csv, but I noticed that if I try to get more than 1.5k messages (the chat has something like 500k messages), get_history doesn't return.

Going into the cli, the same thing happens. I managed to get 10k once, but anything above that has never worked for me. I'm just using the command, history [CHATNAME] 10000.

Is there an implicit limit or something? How would I go about getting the entire history of a chat?

Shikib avatar Dec 16 '15 20:12 Shikib

history command has another argument named offset.

history [chat_name] [count_of_messages] [offset]

e.g history [chat_name] 100 0 returns first 100 messages and history [chat_name] 100 100 returns next 100 messages and so on. you should do it by a loop.

pishgaman-org avatar Feb 14 '16 06:02 pishgaman-org

BTW, do anyone have any success with using offset parameter for fetching channels? For me it returns always the same data. I'm using the test branch

che-shr-cat avatar Feb 14 '16 09:02 che-shr-cat