I am writing an address book bot for my group chat. The main idea of the bot is the ability to search for telegram contacts. For example, /find <first name & last name>the search database and answer indicate the registered user, so that people can contact this person by clicking on his mention (via [inline mention of a user](tg://user?id=123456789)).
The problem is that sometimes the bot gets ENTITY_MENTION_USER_INVALID. In addition, after a few minutes, the mention of this user can be successful. As a workaround, I'm trying to use @userName instead of mentioning userId, but now I have one more problem: not all people have @userName.
Therefore, the question arises: how to avoid an error ENTITY_MENTION_USER_INVALID?
source
share