如何在电报机器人中建立单词链接?
how to make links for words in telegram bot?
我想为电报机器人中的单词制作一个url。
使用此代码但它不起作用:
https://api.telegram.org/bot$botToken/sendMessage?chat_id=chat_id&text=<a href="url.com">the word</a>
如何使link换句话。当用户点击该词时,他将转到url地址页面
你应该使用parse_mode参数:
$url = 'https://api.telegram.org/bot<BOT_TOKEN>/sendMessage';
$parameters = [
'text' => '<a href=\'url.com\'>word</a>',
'chat_id' => <chat_id>,
'parse_mode' => 'HTML'
];
echo $url . '?' . http_build_query($parameters);
输出:
https://api.telegram.org/bot<BOT_TOKEN>/sendMessage?text=%3Ca+href%3D%27url.com%27%3Eword%3C%2Fa%3E&chat_id=<chat_id>&parse_mode=HTML
我想为电报机器人中的单词制作一个url。
使用此代码但它不起作用:
https://api.telegram.org/bot$botToken/sendMessage?chat_id=chat_id&text=<a href="url.com">the word</a>
如何使link换句话。当用户点击该词时,他将转到url地址页面
你应该使用parse_mode参数:
$url = 'https://api.telegram.org/bot<BOT_TOKEN>/sendMessage';
$parameters = [
'text' => '<a href=\'url.com\'>word</a>',
'chat_id' => <chat_id>,
'parse_mode' => 'HTML'
];
echo $url . '?' . http_build_query($parameters);
输出:
https://api.telegram.org/bot<BOT_TOKEN>/sendMessage?text=%3Ca+href%3D%27url.com%27%3Eword%3C%2Fa%3E&chat_id=<chat_id>&parse_mode=HTML