Closed NurgisaA closed 1 year ago
Telegram has no methods to get user by username.
If you want to know usernames you should save (and update) it from ALL incoming messages to some storage (DB) but you don't have and you can't have any guarantees of data relevance.
I will close this issue, if you have further questions, please open a new issue or discussion.
I use for example the command in group chats /rp User1 @user2 ...
User - has type text_mention and can get id @user1 - does not have username or id
I can get by offset and length username. But when searching the database, I can't be sure that the user hasn't changed username. Is there any way to avoid errors and does telegram api support it?
[MessageEntity(type='bot_command', offset=0, length=3, url=None, user=None, language=None, custom_emoji_id=None), MessageEntity(type='text_mention', offset=4, length=7, url=None, user=User(id=0000000000, is_bot=False, first_name='first name', last_name=None, username=None, language_code=None, is_premium=None, added_to_attachment_menu=None, can_join_groups=None, can_read_all_group_messages=None, supports_inline_queries=None), language=None, custom_emoji_id=None), MessageEntity(type='mention', offset=12, length=10, url=None, user=None, language=None, custom_emoji_id=None)]