telegraf
Version:
📡 Modern Telegram bot framework
13 lines (9 loc) • 470 B
JavaScript
const Telegraf = require('telegraf')
const bot = new Telegraf(process.env.BOT_TOKEN)
bot.command('image', (ctx) => ctx.replyWithPhoto({ url: 'https://picsum.photos/200/300/?random' }))
bot.on('text', ({ replyWithHTML }) => replyWithHTML('<b>Hey there!</b>'))
// Set telegram webhook
// npm install -g localtunnel && lt --port 3000
bot.telegram.setWebhook('https://-----.localtunnel.me/secret-path')
// Start https webhook
bot.startWebhook('/secret-path', null, 3000)