【发布时间】:2017-06-06 04:06:48
【问题描述】:
我正在使用此功能通过 node.js 发送照片,但这不起作用。 电报机器人API https://www.npmjs.com/package/telegram-bot-api
var telegram = require('telegram-bot-api');
var api = new telegram({
token: '<PUT YOUR TOKEN HERE>',
});
api.sendPhoto({
chat_id: <YOUR CHAT ID>,
caption: 'This is my test image',
// you can also send file_id here as string (as described in telegram bot api documentation)
photo: '/path/to/file/test.jpg'
})
.then(function(data)
{
console.log(util.inspect(data, false, null));
});
但我有这个错误
fn = function () { throw arg; };
^
StatusCodeError: 403 - [object Object]
【问题讨论】:
-
您是否使用任何节点包来实现电报机器人API?如果您没有使用任何电报机器人节点包,则 sendPhoto 函数应包含目标用户 ID 等参数以及 sendPhoto(userId, photo_url) 等照片 url
-
我正在使用电报机器人 API 模块,但我有这个错误 fn = function () { throw arg; }; ^ StatusCodeError: 403 - [object Object]
标签: javascript java node.js telegram telegram-bot