UNPKG

telegraf

Version:

📡 Modern Telegram bot framework

15 lines (12 loc) 537 B
const Telegraf = require('telegraf') const Extra = require('telegraf/extra') const Markup = require('telegraf/markup') const keyboard = Markup.inlineKeyboard([ Markup.urlButton('❤️', 'http://telegraf.js.org'), Markup.callbackButton('Delete', 'delete') ]) const bot = new Telegraf(process.env.BOT_TOKEN) bot.start((ctx) => ctx.reply('Hey there!')) bot.on('message', (ctx) => ctx.telegram.sendCopy(ctx.from.id, ctx.message, Extra.markup(keyboard))) bot.action('delete', ({ deleteMessage }) => deleteMessage()) bot.startPolling()