Sometimes the bot cannot mention the user by id

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?

+4
source share
1 answer

As said here :

These mentions are only guaranteed if the user has contacted the bot in the past or is a member of the group in which he was mentioned.

You can only mention users who have at least launched the bot.

0
source

Source: https://habr.com/ru/post/1689617/


All Articles