【发布时间】:2019-08-27 09:58:05
【问题描述】:
我想通过 javascript 在我的电报机器人中创建按钮,并且我在脚本 google 中工作。
但它没有获取。
我的代码:
function a() {
const opts = {
reply_to_message_id: '690534265',
reply_markup: {
resize_keyboard: true,
one_time_keyboard: true,
keyboard: [ ['test'], ['test1'] ]
}
};
MainKeyBoard(opts, 'afs', '690534265');
}
function MainKeyBoard(tasti, toxt, chid) {
var url = link + '/sendMessage?parse_mode=Markdown' +
'&chat_id=' + chid +
'&text=' + toxt +
'&reply_markup=' + tasti;
var respose = UrlFetchApp.fetch(url);
}
这是我的错误:
Request failed for https://api.telegram.org/bot745193421:<token>/sendMessage?parse_mode=Markdown&chat_id=690534265&text=afs&reply_markup=[object%20Object] returned code 400. Truncated server response: {"ok":false,"error_code":400,"description":"Bad Request: can't parse reply keyboard markup JSON object"} (use muteHttpExceptions option to examine full response)
我尝试添加 JSON.parse 但错误:
SyntaxError: Unexpected token: o
【问题讨论】:
标签: javascript bots telegram