我有一个通用功能,可以通过电报机器人发送菜单(如下所示),但是我不知道如何在这些菜单上添加图标(mypokerbot的方式,检查图像)。有什么提示吗?
function SendGenericMenu ($chatid) {
$lista=array("A", "B", "C");
$text="Choose:";
global $bottoken;
$replyMarkup = array(
'keyboard' => $lista,
);
$encodedMarkup = json_encode($replyMarkup);
$content = array(
'chat_id' => $chatid,
'reply_markup' => $encodedMarkup,
'text' => "$text"
);
$ch = curl_init();
$url="https://api.telegram.org/bot$bottoken/SendMessage";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($content));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
curl_close ($ch);
var_dump($server_output);
}
Run Code Online (Sandbox Code Playgroud)
您应该使用表情符号,从此处获取:
http : //apps.timwhitlock.info/emoji/tables/unicode
单击Unicode列可以获取不同编码的值。
将表情符号字符串与您的消息连接起来以构建键盘文本。
对于Java,它将是:
String s = new String(new byte[]{(byte) 0xF0, (byte) 0x9F, (byte) 0x98, (byte) 0x81}, "UTF-8");
Run Code Online (Sandbox Code Playgroud)
要么
String s = "\uD83D\uDE4C" + "myKeyboardTest";
Run Code Online (Sandbox Code Playgroud)
对于PHP,我认为是这样的:
"\xF0\x9F\x98\x81" . "your super keyboard"
Run Code Online (Sandbox Code Playgroud)