iszver / telegraf

πŸ“‘ Modern Telegram bot framework

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

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.

Features

Installation

$ npm install telegraf --save

Telegram token

To use the Telegram Bot API, you first have to get a bot account by chatting with BotFather.

BotFather will give you a token, something like 123456789:AbCdfGhIJKlmNoQQRsTUVwxyZ. With the token you can start developing your bot.

Quick start

Step-by-step instructions for building and deploying basic bot with πŸ€– micro-bot (Telegraf high level wrapper).

Documentation

Telegraf developer docs

Example

const Telegraf = require('telegraf')

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

app.command('start', (ctx) => {
  console.log('start', ctx.from)
  ctx.reply('Welcome!')
})

app.hears('hi', (ctx) => ctx.reply('Hey there!'))

app.on('sticker', (ctx) => ctx.reply('πŸ‘'))

app.startPolling()

There's some cool examples.

About

πŸ“‘ Modern Telegram bot framework

http://telegraf.js.org

License:MIT License


Languages

Language:JavaScript 100.0%