如何为api bot电报发送粗体或斜体信息?

时间:2016-06-29 15:34:19

标签: sendmessage telegram telegram-bot

如何为api bot电报发送粗体或斜体信息?

https://api.telegram.org/bottoken/sendMessage?parse_mod=Markdown&chat_id=@testadminch&text=*bold*

输出为:*bold* 但应该是:粗体

抱歉我的英文不好

1 个答案:

答案 0 :(得分:1)

您需要将parse_mode设置为markdown

$post = array("chat_id" => $id, "text"=> $text, "parse_mode" => "markdown");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://api.telegram.org/bot" . $GLOBALS["token"] . "/sendMessage");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_exec ($ch);    
curl_close ($ch);