Skip to content

get_chats() does not work as expected. #502

Open
@asarubbo

Description

@asarubbo

Hello, I noticed this behavior more that once.

I have a group that sends ~1000 messages per day, where in each message there is an image, so it takes a while to synchronize.

The original code was:

tg.login()

result_get_chats = tg.get_chats()
result_get_chats.wait()
if result_get_chats.error:
    print(f'get chats error: {result_get_chats.error_info}')

def new_message_handler(update):
    ....

tg.add_message_handler(new_message_handler)
tg.idle()
tg.stop()

And with this code, when I launch a bot (after e.g. 2 days that I wasn't use it), it fails to synchronize the messages in a short time interval and then it behaves like that messages are received in real time.

I added also a time.sleep(30) before def new_message_handler(update) but it does not improve.

How to be sure that get_chats() works as expected and fetches everything before start to work? Basically result_get_chats.wait() should do the job but it doesn't.

To reproduce, I think you need to setup a bot, make a login, then shutdown and fill a group with thousand of messages/photos and then start again the bot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions