telegram-cli-backup icon indicating copy to clipboard operation
telegram-cli-backup copied to clipboard

Offset

Open mjza opened this issue 9 years ago • 15 comments
trafficstars

Hi, I want to retrieve all my 35000 messages of one of my contacts.

It is possible to send offset in history method but I don't know how to add this option.

Can you guide me?

mjza avatar Feb 03 '16 11:02 mjza

Hi, I am not sure if I understood you correctly. Have you tried changing the MESSAGE_COUNT in line 3? If MESSAGE_COUNT is set to 500, it means that it tries to retrieve the last 500 messages.

psamim avatar Feb 04 '16 07:02 psamim

I had 32000 messages in one account and it is not possible to retrieve all in one connection.

So it has to be send in smaller requests by using offset.

Anyway, thanks I wrote a program in php and solved my problem.

mjza avatar Feb 04 '16 11:02 mjza

Is it a limit impose by Telegram or you got some error?

On Thu, Feb 4, 2016, 2:53 PM Mahdi Jaberzadeh Ansari < [email protected]> wrote:

I had 32000 messages in one account and it is not possible to retrieve all in one connection.

So it has to be send in smaller requests by using offset.

Anyway, thanks I wrote a program in php and solved my problem.

— Reply to this email directly or view it on GitHub https://github.com/psamim/telegram-cli-backup/issues/12#issuecomment-179780410 .

psamim avatar Feb 04 '16 11:02 psamim

There was not any error. Just does not return anything. You have to use offset. Just take a look at telegram-cli for history function

history [limit] [offset] Prints messages with this peer (most recent message lower). Also marks messages as read

https://github.com/vysheng/tg/wiki/Telegram-CLI-Commands

mjza avatar Feb 04 '16 11:02 mjza

By looking at https://github.com/vysheng/tg/blob/master/lua-tg.c#L1128, it seems that in the Lua binding the offset is hardcoded as 0.

psamim avatar Feb 05 '16 07:02 psamim

I made a pull request and added a new function to the Lua binding to be able to get history with limit and offset, waiting to be merged.

https://github.com/vysheng/tg/pull/987

psamim avatar Feb 06 '16 08:02 psamim

Nice, Thanks.

mjza avatar Feb 07 '16 08:02 mjza

@psamim Can only load 3000 messages, 3001 gives nothing

s0w4 avatar Sep 02 '16 08:09 s0w4

@vstet Are you using my pull request for tg or the master branch of tg?

psamim avatar Sep 02 '16 09:09 psamim

@psamim just the main instructions from the README.org

s0w4 avatar Sep 02 '16 21:09 s0w4

@vstet Then it is a limit from Telegram API, you can fetch 3000 by 3000 using offsets.

psamim avatar Sep 03 '16 05:09 psamim

@mjza could you publish it?

mrPsycho avatar Jun 07 '17 08:06 mrPsycho

Hi. Congratulations on the tool. One question, I am not able to configure it to make me a backup of all the channels and superchannels ... Can you help me? Thank you

ToMas-hack avatar Sep 18 '17 13:09 ToMas-hack

I would like to save the information in a database type sqlite3

ToMas-hack avatar Sep 18 '17 14:09 ToMas-hack

@ToMas-hack I have not tested this scripts for channels.

psamim avatar Sep 19 '17 14:09 psamim