I need send an image url to telegram without display image url and hidden url. I see a telegram bot and it's do it very well and send long message with image I'm attach this bot result image see it. Now how can do it in my custom bot? It's possible hidden url with MARKDOWN style or any way? I want hidden image url in my text but telegram display my image. see my sample attach image. thank you
问题:
回答1:
Most of them use the dot (or some things like this character) for link description and you thought there is no link.
You can type the following line and select custom markdown
:
@bold [.](http://www.planwallpaper.com/static/images/i-should-buy-a-boat.jpg)
If you want to add text to your link, you need to create a bot and use this approach in the bot.
Edit:
For sending hyperlink with the bot api you can simply send html markup and using parse_mode
. See telegram documents:
To use this mode, pass HTML in the parse_mode field when using sendMessage. The following tags are currently supported:
<b>bold</b>, <strong>bold</strong>
<i>italic</i>, <em>italic</em>
<a href="http://www.example.com/">inline URL</a>
<a href="tg://user?id=123456789">inline mention of a user</a>
<code>inline fixed-width code</code>
<pre>pre-formatted fixed-width code block</pre>
sample:
<a href="http://www.planwallpaper.com/static/images/i-should-buy-a-boat.jpg"></a>
回答2:
You can use  
character as hidden character.
回答3:
The key of answer is zero-width non-joiner (ZWNJ) character. ZWNJ is encoded in Unicode as U+200C ZERO WIDTH NON-JOINER
(HTML ‌
, ‌
).
HTML mode:
<a href="https://t.me/something">‌</a>
MARKDOWN mode:
Insert character U+200C in []
.
If you are using linux or mac OS with standard persian keyboard you can insert it simply by pressing Shift+Space
. In windows OS you probably could insert it by pressing Ctrl+Shift+2
in persian keyboard.
[](https://t.me/something)
Note about ZWNJ from wikipedia: The zero-width non-joiner (ZWNJ) is a non-printing character used in the computerization of writing systems that make use of ligatures. The ZWNJ is encoded in Unicode as U+200C ZERO WIDTH NON-JOINER (HTML
‌
).
回答4:
According to the Telegram API, it seems if you set disable_web_page_preview
to true
, you should get the result you want.
The final message should look something like this:
{
chat_id: 1235,
message: "http://your/url",
disable_web_page_preview: true,
}
EDIT: It seems I misunderstood the question, and you actually want the image to appear by itself rather than the url by itself.
Again, as per the Telegram API you can send an image directly. But as far as I can tell, you can't use a URL to do it. You would have to upload the photo from your telegram server directly. You could use the caption
property to send text with it.
Here is an example of how you might be able do this in python. You will need to tweak this to whichever language you are using, but the concept is the same.
import requests
response = requests.post(
"https://your.bot.url.com/sendPhoto",
data={
"chat_id": 1234,
"caption": "Your extra text here"
}
files={
"photo": (
"image_name.jpg",
"contents of image",
"image/jpg",
{},
)
}
)
The caption
property has a limit of 200 characters, so if you want to send more characters then that, you'll have to send two messages.
You can always ask Telegram to add this type of functionality in the future