Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Telegraf = require('telegraf')
- const bot = new Telegraf(process.env.BOT_TOKEN)
- bot.use((ctx, next) => {
- const start = new Date()
- return next(ctx).then(() => {
- const ms = new Date() - start
- console.log('Response time %sms', ms)
- })
- })
- bot.start((ctx) => ctx.reply('Welcome!'))
- bot.help((ctx) => ctx.reply('Send me a sticker'))
- bot.on('sticker', (ctx) => ctx.reply('👍'))
- bot.hears('hi', (ctx) => ctx.reply('Hey there'))
- bot.launch()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement