如何通过 Telegram Bot API 在消息中发送嵌入图像和文本 [英] How to send an Embedded Image along with text in a Message via Telegram Bot API
问题描述
使用 Telegram Bot API,
Using Telegram Bot API,
我知道可以通过 https://core.telegram 发送图像.org/bots/api#sendphoto
但是,如何将远程图像嵌入到格式化消息中?
However, how can I embed a remote image into a formatted message?
我要发送的消息可以比作标题为粗体、图像和带有链接的较长文本的新闻文章.我想出了如何使用 Markdown 创建粗体文本和链接,但我无法插入图像.我们该怎么做?
The message I am looking to send, can be compared to a news article with a title in bold, an image, and a longer text with links. I figured out how to create bold text and links with markdown, but I'm failing at inserting images. How can we do that?
推荐答案
你必须在 HTML 中设置 ParseMode 并在 A 标签中设置你的 Image Url,如下所示:
you must set ParseMode in HTML and set your Image Url in A tag like this:
<a href="' + image + '">‍</a>
‍
-> 从不显示在消息中
‍
-> never show in message
这篇关于如何通过 Telegram Bot API 在消息中发送嵌入图像和文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!