tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

When I use getChat the chat cache is added to the internal TdLib repository with a huge delay #2458

Closed 1Dradon1 closed 1 year ago

1Dradon1 commented 1 year ago

I want to use getChat before getUser, because otherwise getUser returns "user not found". But I found out that without a 5 second delay after calling getChat, getUser still returns "user not found" It seems to me that this happens because TdLib doesn't have time to write cache about chat to internal storage, if this is so, how can I make sure to wait for cache writing to internal storage. If I'm wrong, what's the problem and how to solve it? await doesn't help...

levlam commented 1 year ago

It is not possible to get a user or a chat by its identifier. You can only use user and chat identifiers that were received from TDLib, which makes the methods getUser and getChat useless for regular users.

1Dradon1 commented 1 year ago

Is there any way I can get full information about each chat user?

levlam commented 1 year ago

You can get some chat members with getBasicGroupFullInfo or getSupergroupMembers depending on type of the chat.

1Dradon1 commented 1 year ago

yes, I already use getBasicGroupFullInfoto get the users ids, but then I want to get FirstName and LastName how do i do that? i figured out i need to use getUser In this case I am facing the above problem

levlam commented 1 year ago

No, you need to handle updateUser updates and have all the data always available. See https://core.telegram.org/tdlib/getting-started for more details.

1Dradon1 commented 1 year ago

Got it, thanks