New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Entities "seen" in "@client.on(events.NewMessage)" only available after client is manually restarted #3989
Comments
Does it work if you do |
Thank you very much for the very rapid reply and help. I tested it and |
The way one is expected to learn about this is in the documentation is:
It is true that it is kind of obscure to find, but it is there. When an object is received after making a call, it's checked to see if it contains entities: Telethon/telethon/client/users.py Line 75 in 83f13da
This is currently not true when receiving updates here: Telethon/telethon/client/updates.py Line 381 in 83f13da
Can't remember if updates were passed to this method. I guess it could be added there. But then people are more likely to complain the memory usage grows (at least I suspect this might be it), so I can't really win. Maybe the entity cache should be flushed every so often and cleared from memory. |
Probably the better option is to get rid of |
Checklist
pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip
and triggered the bug in the latest version.Hi everyone,
I have run into the problem that I cannot access information about forwarded channels via "get_input_entity" when streaming new events/messages. The reason seems to be that the .sessions cache does not update until after the client has disconnected.
If I re-run the code a second time, all channels which had been forwarded during the first run of the code now resolve without problems, however, forwards from new and previously unseen channels raise the same "could not find the input entity for PeerChannel.." error.
What might be needed to resolve this would be to provide a way through which the sessions cache can be updated/reloaded while client.run_until_disconnected() is still running.
Thank you very much!
Code that causes the issue
Traceback
The text was updated successfully, but these errors were encountered: