aahnik / tgcf

The ultimate tool to automate custom telegram message forwarding. Live-syncer, Auto-poster, backup-bot, cloner, chat-forwarder, duplicator, ... Call it whatever you like! tgcf can fulfill your custom needs.
https://github.com/aahnik/tgcf/wiki
MIT License
1.34k stars 795 forks source link

Does not forward from particular group #443

Closed navtemmt closed 1 year ago

navtemmt commented 1 year ago

Describe the bug Hello, i was trying to forward a group chat(private group with copy content access) with 192 members that I was not allowed to send messages, i tried using live mode and forward from that particular chat but it is not working, but then i setup another group for test purpose the forward is working, double checked the chat id and confirm it is correct. Then i tried to forward using past mode with user account and here is the error in the logs, for further testing i also replace the particular group with testing group and the forward works well. Could someone please enlighten what is wrong? thank you

Logs: ╭───────────────────── Traceback (most recent call last) ──────────────────────╮ │ /home/ubuntu/tgcfs/.venv/lib/python3.10/site-packages/tgcf/cli.py:116 in │ │ main │ │ │ │ 113 │ if mode == Mode.PAST: │ │ 114 │ │ from tgcf.past import forward_job # pylint: disable=import-ou │ │ 115 │ │ │ │ ❱ 116 │ │ asyncio.run(forward_job()) │ │ 117 │ else: │ │ 118 │ │ from tgcf.live import start_sync # pylint: disable=import-out │ │ 119 │ │ │ │ /usr/lib/python3.10/asyncio/runners.py:44 in run │ │ │ │ 41 │ │ events.set_event_loop(loop) │ │ 42 │ │ if debug is not None: │ │ 43 │ │ │ loop.set_debug(debug) │ │ ❱ 44 │ │ return loop.run_until_complete(main) │ │ 45 │ finally: │ │ 46 │ │ try: │ │ 47 │ │ │ _cancel_all_tasks(loop) │ │ │ │ /usr/lib/python3.10/asyncio/base_events.py:646 in run_until_complete │ │ │ │ 643 │ │ if not future.done(): │ │ 644 │ │ │ raise RuntimeError('Event loop stopped before Future comp │ │ 645 │ │ │ │ ❱ 646 │ │ return future.result() │ │ 647 │ │ │ 648 │ def stop(self): │ │ 649 │ │ """Stop running the event loop. │ │ │ │ /home/ubuntu/tgcfs/.venv/lib/python3.10/site-packages/tgcf/past.py:42 in │ │ forward_job │ │ │ │ 39 │ │ │ last_id = 0 │ │ 40 │ │ │ forward: config.Forward │ │ 41 │ │ │ logging.info(f"Forwarding messages from {src} to {dest}") │ │ ❱ 42 │ │ │ async for message in client.iter_messages( │ │ 43 │ │ │ │ src, reverse=True, offset_id=forward.offset │ │ 44 │ │ │ ): │ │ 45 │ │ │ │ message: Message │ │ │ │ /home/ubuntu/tgcfs/.venv/lib/python3.10/site-packages/telethon/requestiter.p │ │ y:74 in anext │ │ │ │ 71 │ │ │ │ │ 72 │ │ │ self.index = 0 │ │ 73 │ │ │ self.buffer = [] │ │ ❱ 74 │ │ │ if await self._load_next_chunk(): │ │ 75 │ │ │ │ self.left = len(self.buffer) │ │ 76 │ │ │ │ 77 │ │ if not self.buffer: │ │ │ │ /home/ubuntu/tgcfs/.venv/lib/python3.10/site-packages/telethon/client/messag │ │ es.py:184 in _load_next_chunk │ │ │ │ 181 │ │ │ # Remember that we need -limit when going in reverse │ │ 182 │ │ │ self.request.add_offset = self.add_offset - self.request. │ │ 183 │ │ │ │ ❱ 184 │ │ r = await self.client(self.request) │ │ 185 │ │ self.total = getattr(r, 'count', len(r.messages)) │ │ 186 │ │ │ │ 187 │ │ entities = {utils.get_peer_id(x): x │ │ │ │ /home/ubuntu/tgcfs/.venv/lib/python3.10/site-packages/telethon/client/users. │ │ py:30 in call │ │ │ │ 27 │ │ 28 class UserMethods: │ │ 29 │ async def call(self: 'TelegramClient', request, ordered=False, │ │ ❱ 30 │ │ return await self._call(self._sender, request, ordered=ordered │ │ 31 │ │ │ 32 │ async def _call(self: 'TelegramClient', sender, request, ordered=F │ │ 33 │ │ if flood_sleep_threshold is None: │ │ │ │ /home/ubuntu/tgcfs/.venv/lib/python3.10/site-packages/telethon/client/users. │ │ py:84 in _call │ │ │ │ 81 │ │ │ │ │ else: │ │ 82 │ │ │ │ │ │ return results │ │ 83 │ │ │ │ else: │ │ ❱ 84 │ │ │ │ │ result = await future │ │ 85 │ │ │ │ │ self.session.process_entities(result) │ │ 86 │ │ │ │ │ self._entity_cache.add(result) │ │ 87 │ │ │ │ │ return result │ ╰──────────────────────────────────────────────────────────────────────────────╯ ChatIdInvalidError: Invalid object ID for a chat. Make sure to pass the right types, for instance making sure that the request is designed for chats (not channels/megagroups) or otherwise look for a different one more suited\nAn example working with a megagroup and AddChatUserRequest, it will fail because megagroups are channels. Use InviteToChannelRequest instead (caused by GetHistoryRequest)

navtemmt commented 1 year ago

refer #430 for solution