depoio / node-telegram-bot

Client wrapper for Telegram Bot API (Under heavy development)
MIT License
136 stars 30 forks source link

Still possible to use streams instead of filepath? #74

Open ishan-marikar opened 8 years ago

ishan-marikar commented 8 years ago

Is it still possible to use streams instead of the file path when sending images/videos/etc? I get the images off another server, which is why I need it :/

bot.sendPhoto({
  chat_id: USER_ID,
  caption: 'Telegram Logo',
  files: {
    photo: {
      filename: './examples/logo.png',
      stream: fs.createReadStream('./examples/logo.png')
    }
  }
}, function (err, msg) {
  console.log(err);
  console.log(msg);
});
derhuerst commented 8 years ago

Seems like it.

It would be nice to let node-telegram-bot accept vinyl files instead of custom solutions. Then, one could reuse the existing vinyl ecosystem.