Telegram Bot 通过 Node.js 发送 PDF 文件
Telegram Bot Send PDF File via Node.js
我正在尝试发送带有 ID 的文件,但对某些文件不起作用,我正在使用
node-telegram-bot-api 模块。
bot.sendDocument(msg.chat.id, "BQADBAADFAADAllAUeZn_0YHHRjNAg"); //ok
bot.sendDocument(msg.chat.id, "http://kmmc.in/wp-content/uploads/2014/01/lesson2.pdf");//ok
bot.sendDocument(msg.chat.id, "BQADBAADAgAD8jBJUZjgAdwyxsADAg") // Not Ok
我有这个错误:
Unhandled rejection Error: 400 {"ok":false,"error_code":400,"description":"Bad Request: Wrong file identifier/HTTP URL specified"}
电报参考: Here
Sending by file_id
,
file_id 对于每个单独的 bot 都是唯一的,不能从一个 bot 转移到另一个 bot。
执行以下步骤:
1: 将 PDF 文件发送到您的机器人。
2:通过转发到原始机器人 (@RawDataBot) 或 ...
获取该文件 ID
3:通过 node-telegram-bot-api 模块发送。
示例:
bot.sendDocument(msg.chat.id, "BQADBAADAgAD8jBJUZjgAdwyxsADAg")
我正在尝试发送带有 ID 的文件,但对某些文件不起作用,我正在使用 node-telegram-bot-api 模块。
bot.sendDocument(msg.chat.id, "BQADBAADFAADAllAUeZn_0YHHRjNAg"); //ok
bot.sendDocument(msg.chat.id, "http://kmmc.in/wp-content/uploads/2014/01/lesson2.pdf");//ok
bot.sendDocument(msg.chat.id, "BQADBAADAgAD8jBJUZjgAdwyxsADAg") // Not Ok
我有这个错误:
Unhandled rejection Error: 400 {"ok":false,"error_code":400,"description":"Bad Request: Wrong file identifier/HTTP URL specified"}
电报参考: Here
Sending by file_id
,
file_id 对于每个单独的 bot 都是唯一的,不能从一个 bot 转移到另一个 bot。
执行以下步骤:
1: 将 PDF 文件发送到您的机器人。
2:通过转发到原始机器人 (@RawDataBot) 或 ...
获取该文件 ID
3:通过 node-telegram-bot-api 模块发送。
示例:
bot.sendDocument(msg.chat.id, "BQADBAADAgAD8jBJUZjgAdwyxsADAg")