3.36.2 • Published 6 years ago
this-is-a-package-for-draft-stuff-please-dont-use-this-one v3.36.2
Introduction
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
- Full Telegram Bot API 4.6 support
- Telegram Payment Platform
- HTML5 Games
- Inline mode
- Incredibly fast
- now/Firebase/Glitch/Heroku/AWS λ/Whatever ready
http/https/fastify/Connect.js/express.jscompatible webhooks- Easy to extend
TypeScripttypings
Installation
$ npm install telegrafor using yarn:
$ yarn add telegrafDocumentation
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.launch()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.launch()There's some cool examples too.
3.36.2
6 years ago