TrillCyborg / telegraf

📡Telegram bot framework for Node.js

Home Page:https://telegraf.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

telegraf.js

Modern Telegram bot framework.

Bots are special Telegram accounts designed to handle messages automatically. Users can interact with bots by sending them command messages in private or group chats. These accounts serve as an interface for code running somewhere on your server.

Telegraf Bot API Version NPM Version node Build Status js-standard-style

Features

Installation

$ npm install telegraf

or using yarn:

$ yarn add telegraf

Examples

const Telegraf = require('telegraf')

const bot = new Telegraf(process.env.BOT_TOKEN)

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.hears(/buy/i, (ctx) => ctx.reply('Buy-buy'))

bot.startPolling()
const Telegraf = require('telegraf')

const bot = new Telegraf(process.env.BOT_TOKEN)
bot.command('oldschool', (ctx) => ctx.reply('Hello'))
bot.command('modern', ({ reply }) => reply('Yo'))
bot.command('hipster', Telegraf.reply('λ'))
bot.startPolling()

There's some cool examples too.

Documentation

Telegraf developer docs

About

📡Telegram bot framework for Node.js

https://telegraf.js.org

License:MIT License


Languages

Language:JavaScript 99.1%Language:TypeScript 0.9%