knadh / tg-archive

A tool for exporting Telegram group chats into static websites like mailing list archives.
MIT License
895 stars 137 forks source link

Sync private one on one chats #15

Closed kokroo closed 3 years ago

kokroo commented 3 years ago

Can we repurpose this to sync one on one chats?

knadh commented 3 years ago

I think it might just work with private chats out of the box. The get_messages() function does not seem to restrict it to groups.

You can try experimenting with a private chat ID.

Seele0oO commented 2 years ago
Traceback (most recent call last):
  File "/usr/local/bin/tg-archive", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/tgarchive/__init__.py", line 132, in main
    s.sync(args.id, args.from_id)
  File "/usr/local/lib/python3.8/dist-packages/tgarchive/sync.py", line 51, in sync
    group_id = self._get_group_id(self.config["group"])
  File "/usr/local/lib/python3.8/dist-packages/tgarchive/sync.py", line 353, in _get_group_id
    entity = self.client.get_entity(group)
  File "/usr/local/lib/python3.8/dist-packages/telethon/sync.py", line 39, in syncified
    return loop.run_until_complete(coro)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.8/dist-packages/telethon/client/users.py", line 335, in get_entity
    result.append(await self._get_entity_from_string(x))
  File "/usr/local/lib/python3.8/dist-packages/telethon/client/users.py", line 553, in _get_entity_from_string
    result = await self(
  File "/usr/local/lib/python3.8/dist-packages/telethon/client/users.py", line 30, in __call__
    return await self._call(self._sender, request, ordered=ordered)
  File "/usr/local/lib/python3.8/dist-packages/telethon/client/users.py", line 84, in _call
    result = await future
telethon.errors.rpcerrorlist.FloodWaitError: A wait of 22500 seconds is required (caused by ResolveUsernameRequest)

The bug occurred in a conversation to an individual user, another task that was executing in the group at the same speed was not affected. Will this problem be considered for a solution?

knadh commented 2 years ago

telethon.errors.rpcerrorlist.FloodWaitError: A wait of 22500 seconds is required (caused by ResolveUsernameRequest)

Not sure if this can be handled in the app. Looks like a rate limit for doing multiple syncs simultaneously.

Seele0oO commented 2 years ago

Ok, I will enable different accounts to test, the sync speed will be set to /5 *.are you think the speed is faster than normal?

Seele0oO commented 2 years ago