1

Stack overflow!

I'm using telebot module for my telegram bot (from telebot import types). I want to send messages to telegram users. In this messages I want to paste a link to another telegram users.

My code is:

linked_user = '[username](tg://user?id=999999999)'
bot.send_message(
    admin_chat_id, f'{linked_user}',
    parse_mode='MarkdownV2',
    disable_web_page_preview=True)

I expect that admin will receive a message with username in it. And if admin will click on the text, he will be redirected to the linked_user's profile...

The problem is:

It's not always a hyperlinked text. It can be a plain text... With some user's chat.id's it works well, with other - don't!

I tried to make decisions from the fact, than not every telegram user have 9-digit chat.id - but it's not the reason too...

So I want to make hyperlink for EVERY user... don't know how to do that, so please help me!)

ML777
  • 13
  • 4

1 Answers1

0

Some Users have specific privacy settings. So even though you can pm them, you cant "publish" their usernames so anyone else can Contact them. So you are not doing anything wrong.

JyR27
  • 16
  • What should telegram user do in his privacy settings to make his username hyperlinked? – ML777 Nov 24 '22 at 09:36
  • Just go to settings and create a user Name witch starts by @. After that, It is just a question of making the bot sending a message with @+{username} – JyR27 Nov 25 '22 at 10:05
  • So if some user DIDN'T set a user_name (that starts from "@") for himself, then this case does not work at all. And if he DID - it should work every time. Am I right? – ML777 Nov 26 '22 at 16:39
  • Yes, that is the point but I am sure there is a way to mention by name and lastname , but I just havent figured It out yet. If I find It out, I Will let you know, i am working on It – JyR27 Nov 27 '22 at 17:18