Telegram 机器人不发送带有超链接的标题
Telegram bot does not send caption with hyperlink
我的电报机器人不会在照片、视频、语音的标题中发送超链接。
这很奇怪,因为超链接适用于纯文本。
下面是我的 sendPhoto
方法代码
<?php
$p1="<a href=google.com>google</a>";
$url= "https://api.telegram.org/bot".$token."/sendPhoto?parse_mode=HTML&chat_id=".$chat_id."&photo=".$photo."&caption=".urlencode($p1);
file_get_contents($url);
?>
它正确发送照片并发送标题但没有任何超链接:(
以下代码用于 sendMessage
方法
<?php
$url= "https://api.telegram.org/bot".$token."/sendMessage?parse_mode=HTML&chat_id=".$chat_id."&text=".urlencode($p1);
file_get_contents($url);
?>
但是 sendMessage
是正确的..
作为对 sendPhoto
的回应,我有:
<?
"caption_entities":[{"offset":0,"length":5,"type":"text_link","url":"http://google.com/"}
?>
我该如何解决?
botfather中有没有配置?
可能您使用的客户端还不支持,比如TDesktop。
我已发送 this payload,在桌面上看到正常文本,但在 Android 客户端中有 HTML 标记。
标题中的富文本是新功能,只有官方 Telegram 的最新 android 版本(不是 Mobogram 等)可以显示它。
例如:
你看到 this post 同上图了吗?
我的电报机器人不会在照片、视频、语音的标题中发送超链接。
这很奇怪,因为超链接适用于纯文本。
下面是我的 sendPhoto
方法代码
<?php
$p1="<a href=google.com>google</a>";
$url= "https://api.telegram.org/bot".$token."/sendPhoto?parse_mode=HTML&chat_id=".$chat_id."&photo=".$photo."&caption=".urlencode($p1);
file_get_contents($url);
?>
它正确发送照片并发送标题但没有任何超链接:(
以下代码用于 sendMessage
方法
<?php
$url= "https://api.telegram.org/bot".$token."/sendMessage?parse_mode=HTML&chat_id=".$chat_id."&text=".urlencode($p1);
file_get_contents($url);
?>
但是 sendMessage
是正确的..
作为对 sendPhoto
的回应,我有:
<?
"caption_entities":[{"offset":0,"length":5,"type":"text_link","url":"http://google.com/"}
?>
我该如何解决?
botfather中有没有配置?
可能您使用的客户端还不支持,比如TDesktop。
我已发送 this payload,在桌面上看到正常文本,但在 Android 客户端中有 HTML 标记。
标题中的富文本是新功能,只有官方 Telegram 的最新 android 版本(不是 Mobogram 等)可以显示它。
例如: