telegraf-image
Version:
Telegraf Image Downloader
16 lines (13 loc) • 507 B
JavaScript
var helper = require('telegraf-image');
require('dotenv').config();
const Telegraf = require('telegraf')
const Extra = require('telegraf/extra')
const bot = new Telegraf(process.env.TOKEN)
bot.on(['photo'], async (ctx) => {
imageData = await bot.telegram.getFile(ctx.message.photo[ctx.message.photo.length - 1].file_id);
console.log(imageData);
helper.download(imageData, imageData.file_path, process.env.TOKEN, function () {
console.log(imageData.file_path);
})
});
bot.launch();