我用laravel创建了一个电报机器人队。代码的一部分。
$available_buttons =ReportToAbonent::select("report_id")
->join("telegram.reports", "report_to_abonent.report_id", "=", "reports.id")
->where("abonent_id", "=", $abonent[0]->id)
->where("active","=","1")
->get();
$keyboard = array();
foreach ($available_buttons as $value)
{
$keyboard[] = array($value->report_id);
}
$reply_markup = \Telegram::replyKeyboardMarkup([
'keyboard' => $keyboard,
'resize_keyboard' => true,
'one_time_keyboard' => false
]);
如果我打印
$keyboard`, its structure looks like if `$keyboard = [
['7', '8', '9'],
['4', '5', '6'],
['1', '2', '3'],
['0']
];
但在第一种情况下,电报客户端没有键盘。在第二种情况下,它存在。我能做错什么。
答案 0 :(得分:0)
答案 1 :(得分:0)
这是每个键盘的两个例子:
普通键盘:
const opts = {
reply_markup: JSON.stringify({
keyboard: [
['Normal'],
],
resize_keyboard: true,
one_time_keyboard: true,
}),
};
内联键盘:
const inlineopts = {
reply_markup: {
inline_keyboard: [
[{
text: 'Yahoo',
url: 'www.yahoo.com',
}],
[{
text: 'Google',
url: 'www.google.com',
}],
],
},
};