如何在 bot api 电报中为 reply_markup 键盘设置参数?
how to set parametr in bot api telegram for reply mark up keyboard?
我知道这是 url 用于在电报机器人中发送消息 api:
https://api.telegram.org/botTOKEN/sendMessage?chat_id=10101010&text="this
is for test"
但是我如何将参数设置为 url 以使用 ReplymarkupKeyboard
我只需要 url 不需要代码
发送
如果自己找到答案:
为了通过 url 发送 ReplyKeyboardMarkup,我们应该使用这种方式:
https://api.telegram.org/botTOKEN/sendMessage?chat_id=10101010&text="TEST"&reply_markup={"keyboard":[["A","B"]]}
并在 php 中找到此 url(或使用代码发送消息)代码是:
$replyMarkup = array(
'keyboard' => array(
array("A", "B")
)
);
$encodedMarkup = json_encode($replyMarkup);
$content = array(
'chat_id' => "10101010",
'reply_markup' => $encodedMarkup,
'text' => "Test"
);
$newn = json_encode($content);
$newh = json_decode($newn);
echo http_build_query($newh)
我知道这是 url 用于在电报机器人中发送消息 api:
https://api.telegram.org/botTOKEN/sendMessage?chat_id=10101010&text="this is for test"
但是我如何将参数设置为 url 以使用 ReplymarkupKeyboard 我只需要 url 不需要代码 发送
如果自己找到答案:
为了通过 url 发送 ReplyKeyboardMarkup,我们应该使用这种方式:
https://api.telegram.org/botTOKEN/sendMessage?chat_id=10101010&text="TEST"&reply_markup={"keyboard":[["A","B"]]}
并在 php 中找到此 url(或使用代码发送消息)代码是:
$replyMarkup = array(
'keyboard' => array(
array("A", "B")
)
);
$encodedMarkup = json_encode($replyMarkup);
$content = array(
'chat_id' => "10101010",
'reply_markup' => $encodedMarkup,
'text' => "Test"
);
$newn = json_encode($content);
$newh = json_decode($newn);
echo http_build_query($newh)