request("https://api.telegram.org/bot"+TOKEN+"/getFile?file_id=" + file_id, { json: true }, (err, res, body) => {
if (err) { return console.log(err); }
console.log(body.result.file_path);
full = "https://api.telegram.org/file/bot"+TOKEN+"/" + body.result.file_path;
console.log (full);
const file = fs.createWriteStream("file.ogg");
const request = https.get(full, function(response) {
response.pipe(file)
})
});
});
Unhandled rejection Error: ETELEGRAM: 400 Bad Request: file_id not specified
error: [polling_error] {}
bot.getFile(voiceId).then((resp) => {
{
file_id = (msg.voice.file_id),
file_size = (msg.voice.file_size),
file_path = "https://api.telegram.org/bot" + TOKEN + "/getFile?file_id="+file_id
}
bot.getFileLink(voiceId).then((resp) => {
"https://api.telegram.org/file/bot" + botToken + "/" + file_path
});