id but not joined in that group? or i need to join it first?
You must join the chat to use its id in requests, unless it was cached in the .session file before
so if the group is public, i can use get_entity with its id without joining the group? and how to check if its id cached in .session file or not?
you use get_entity usually to see if it's cached, it raises ValueError if it wasn't, you can't get that chat with id then, public or not doesn't matter
so the important thing is joining it first, before using get_entity? but how if i leave the group? is it still cached?
Documentation for get_entity
If the group was seen from telethon before, it'll be cached even if you left by the other clients, through any of the request like get_dialogs or receiving events from that chat basically, if you could ever fetch a chat with get_entity and it never raised a ValueError, it never will and it will always be possible to get_entity it thereafter, unless you delete the session file
if i delete session file, i need to relogin and get the token, right? is session file permanent? or do i need to relogin it after some time? because my first login is in july. :D
What if i have a bot that interact with mellions of users does it use same aproch? that means the session file will be much bigger
well noted, thanks.
It's not going to be that big. for a bot of that scale, it's insignificant.
v2 won't persist entities by itself, fwiw
Обсуждают сегодня