const {Telegraf} = require('telegraf');
const Koa = require('koa');
const koaBody = require('koa-body');
const bot = new Telegraf(process.env.BOT_TOKEN);
bot.telegram.setWebhook('https://runkit.io/descartes100/kit/branches/master');
bot.on('text', ({reply}) => reply('The time here is ::'+ new Date()));
const app = new Koa()
app.use(koaBody());
app.use((ctx, next) => ctx.method === 'POST' || ctx.url === '/secret-path'
? bot.handleUpdate(ctx.request.body, ctx.response)
: next()
);
app.listen(3000);