telegraf

node v15.14.0
version: 6.0.0
endpointsharetweet
const {Telegraf} = require('telegraf') const bot = new Telegraf(process.env.BOT_TOKEN) bot.command('quit', (ctx) => { // Explicit usage ctx.telegram.leaveChat(ctx.message.chat.id) // Using context shortcut ctx.leaveChat() }) bot.on('text', (ctx) => { console.log(ctx.update.message.from.username); // Explicit usage ctx.telegram.sendMessage(ctx.message.chat.id, `Stai dicendo cazzate ${ctx.update.message.from.username}!`) }) bot.launch() // Enable graceful stop process.once('SIGINT', () => bot.stop('SIGINT')) process.once('SIGTERM', () => bot.stop('SIGTERM'))
Loading…

no comments

    sign in to comment