tg icon indicating copy to clipboard operation
tg copied to clipboard

offset of history do not work with channels

Open RezaSR opened this issue 10 years ago • 12 comments

When set offset greater than 0 in history command of channels, it always returns the following error: {"result": "FAIL", "error_code": 71, "error": "RPC_CALL_FAIL 400: OFFSET_INVALID"}

It works with super groups with no problem, but with channels it does not work at all. (I tested this with the latest version of test branch)

Please help me.

RezaSR avatar Jan 19 '16 12:01 RezaSR

I have same problem.

pishgaman-org avatar Feb 18 '16 08:02 pishgaman-org

I solved it! open queries.c file located in tgl directory. find _tgl_do_get_history function and comment some lines as follows :

static void _tgl_do_get_history (struct tgl_state *TLS, struct get_history_extra *E, void (*callback)(struct tgl_state *TLS,void *callback_extra, int success, int size, struct tgl_message *list[]), void *callback_extra) {
  clear_packet ();
  //tgl_peer_t *C = tgl_peer_get (TLS, E->id);
  //if (tgl_get_peer_type (E->id) != TGL_PEER_CHANNEL || (C && (C->flags & TGLCHF_MEGAGROUP))) {
    out_int (CODE_messages_get_history);
    out_peer_id (TLS, E->id);
  //} else {    
  //  out_int (CODE_channels_get_important_history);

  //  out_int (CODE_input_channel);
  //  out_int (tgl_get_peer_id (E->id));
  //  out_long (E->id.access_hash);
  // }
  out_int (E->max_id);
  out_int (E->offset);
  out_int (E->limit);
  out_int (0);
  out_int (0);
  tglq_send_query (TLS, TLS->DC_working, packet_ptr - packet_buffer, packet_buffer, &get_history_methods, E, callback, callback_extra);
}

save and recompile and enjoy!

pishgaman-org avatar Feb 19 '16 07:02 pishgaman-org

Thanks for ur help, I will try it.

RezaSR avatar Feb 20 '16 09:02 RezaSR

@pishgaman-org Thanks a lot! It works!

che-shr-cat avatar Feb 25 '16 16:02 che-shr-cat

Fixed - https://github.com/vysheng/tgl/pull/115

Goblenus avatar Sep 10 '16 21:09 Goblenus

hi I can dumping message for channel but I can not dump all message or 1000 number of message, i can dump 50 number of message, are you have solution for dump increase messages?

thank you. thank

alisafari2017 avatar Jun 15 '17 08:06 alisafari2017

@alisafari2017 So...this project is dead. There is a pretty nice python api for telegram https://github.com/LonamiWebs/Telethon. If you have some questions, write me @Goblenus (Telegram)

Goblenus avatar Jun 15 '17 13:06 Goblenus

Not solved yet :( telegram-history-dump.rb:51:in exec_tg_command': Telegram command failed: {"result"=>"FAIL", "error_code"=>71, "error"=>"RPC_CALL_FAIL 400: OFFSET_INVALID"} (RuntimeError)`

yoossarian avatar Nov 26 '17 12:11 yoossarian

@yoossarian Do not use it! This project is dead!

Goblenus avatar Nov 26 '17 16:11 Goblenus

@pishgaman-org Thank you sooo much, works like a charm.

perronet avatar Aug 08 '18 21:08 perronet

@yoossarian Do not use it! This project is dead!

is ist? like, really?

tomasi-o avatar Jul 22 '21 14:07 tomasi-o

Just used telethon, worked like a charm and easy to use. Download 2000+ worth of photos from 2017... The readthedocs is not easy to build the queries but I could manage with partial information from different sources.

JulienNGirard avatar Mar 19 '22 00:03 JulienNGirard