telegraf-image
Version:
Telegraf Image Downloader
27 lines (20 loc) • 623 B
Markdown
You can download telegram bot images via this package
```sh
npm install telegraf-helper --save
```
```
require('dotenv').config();
const Telegraf = require('telegraf')
const bot = new Telegraf(process.env.TOKEN)
var helper = require('telegraf-image');
bot.on(['photo'], async (ctx) => {
imageData = await bot.telegram.getFile(ctx.message.photo[ctx.message.photo.length - 1].file_id);
helper.download(imageData, imageData.file_path, process.env.TOKEN, function () {
console.log(imageData.file_path);
})
});
```