E
E
eifory2020-10-05 14:03:28
Node.js
eifory, 2020-10-05 14:03:28

How to download a large file with a telegram bot?

A person successfully uploads a file from 500 MB to 1.9 GB into the bot.
The bot sees the file_id, but then:
Error: ETELEGRAM: 400 Bad Request: file is too big.
Restrictions when downloading from a link are specified in the documentation.
But it also says that you can send the file, where can I send it?
The task is to download this file by the bot.
If it doesn't work out, will your web / ftp server remain?

I read an article about using the telegram app, but there for downloading a file, and it’s not clear)

bot.on('document', async (msg) => {
  const userId = msg.from.id;
  const { file_path }  = await bot.getFile(msg.document.file_id);
  const url = getDownloadUrl(file_path);
  const source = getSourceFilePath(msg.from.username, msg.document.file_name); 
  const request = https.get(url, (res) => res.pipe(source));
  ...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question