如何在Telegram机器人上的嵌入式键盘中调整长文本

时间:2019-01-10 07:31:57

标签: php telegram-bot

我尝试使用以下代码在电报Bot中制作嵌入式键盘,该键的文本很长,因此应该用两行写,但是现在文本没有写到最后,它有一些点。详情请参见下面的照片

如何显示全文?没几个点

<?php
function RunCom ($comand){
    $url = "https://api.telegram.org/bot<tokkenBot>/";
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url.$comand);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
$res = curl_exec($ch);
    if(curl_error($ch)){
        file_put_contents ("error.txt",$res,FILE_APPEND);
    }else{
        file_put_contents ("respon.txt",$res."\n",FILE_APPEND);
    }
 }
function sndmsg ($chat_id,$text,$morthing){
   $comand = "sendMessage?chat_id=".$chat_id."&text=".$text.@$morthing;
   return RunCom ($comand);
}

$answer[1] = "there is a long text fo test and it is be english, does it work on inline keyboard on tow row?";
$text[0] = array ("text" => "key1","callback_data" => "survey");
$text[1] = array ("text" => wordwrap( $answer[1],52,"\n") ,"callback_data" => "reg");
$replyMarkup = array("inline_keyboard" => array(array($text[0]),array($text[1])));
$morthing = "&reply_markup=".json_encode($replyMarkup);
sndmsg ($chat_id,"custom keyboard need long text for question than aline with keyboard bottun",$morthing);
?>

您可以在这张照片中看到我的结果:

enter image description here

0 个答案:

没有答案