title: How to make Telegram Bot get User info from mention
body: <p>I just started studying the Telegram Bot API to learn how to program a Bot via Java.
  I don't understand how the bot can recognize a user mentioned via <code>@&lt;username&gt;</code> and get info about him.</p>
  
  <p>For example, suppose I want my bot to be able to count and store how many times a user is mentioned into a group. What he needs is the tagged user's <code>id</code>.</p>
  
  <p>I can parse incoming messages to detect entities using <code>update.getMessage().getEntities()</code> then get the type of entity using <code>MessageEntity.getType()</code>. Now, if I understood, there are two types of mention: <code>mention</code> for mentions made trough <code>@&lt;username&gt;</code>, and <code>text_mention</code> for mentions made to users who have no username.
  Here come the problems, because I would expect a bot to be able to retrive more info about a user with username, since it's editable but unique, than about a user without username, since he is 'tagged' using the name he is saved with in the contact list of the sender.
  Instead, only <code>text_mention</code> type <code>MessageEntity</code> object contains <code>User</code> object, from which i can get user's <code>id</code>, as i read in <a href="https://core.telegram.org/bots/api#messageentity" rel="nofollow noreferrer">Telegram Bot API documentation</a>. From <code>mention</code> type <code>MessageEntity</code> object i can just get the username itself as it is the text, but it is not enough because it can be changed.</p>
  
  <p>So my first question is: why? I really don't understand why <code>text_mention</code> should carry info about tagged user while <code>mention</code> should not.</p>
  
  <p>Then the main question is: how can i solve this?</p>