How can i read file? #9

Closed
opened 2015-07-27 07:07:26 +00:00 by rezaaa · 1 comment
rezaaa commented 2015-07-27 07:07:26 +00:00 (Migrated from github.com)

Hi

How can i read file from user?

Hi How can i read file from user?
mdibaiee commented 2015-07-27 10:27:25 +00:00 (Migrated from github.com)

Hey,

Bots using the Telegram API can't save a file sent by user, but they can re-use the file and send it to others.

bot.on('update', updates => {
  updates.forEach(function (update) {
    var message = update.message;
    if (message.document) { // or any of audio, photo, video
      var file = new File(message.document.file_id, 'document');
      bot.send(file).to(message.chat.id);
    }
  });
});

See:

https://core.telegram.org/bots/api#message
https://core.telegram.org/bots/api#sendphoto
https://github.com/mdibaiee/node-telegram-api/wiki/Type:-File

Hey, Bots using the Telegram API can't _save_ a file sent by user, but they can re-use the file and send it to others. ``` javascript bot.on('update', updates => { updates.forEach(function (update) { var message = update.message; if (message.document) { // or any of audio, photo, video var file = new File(message.document.file_id, 'document'); bot.send(file).to(message.chat.id); } }); }); ``` See: https://core.telegram.org/bots/api#message https://core.telegram.org/bots/api#sendphoto https://github.com/mdibaiee/node-telegram-api/wiki/Type:-File
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: thereadme/node-telegram-api#9
No description provided.