Skip to content

botimize/Telegram-sample-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This sample-bot uses Telegraf framework

Documentation

-Telegram Bot API

-Telegraf developer docs

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 in hand, you can start developing your bot.

Message

Message_type:text,video,location,photo...

app.command(<Command>, (ctx) => {
  ctx.reply('Welcome!')
})

app.on(<Message_type>, (ctx) => {
  ctx.reply('Received!'))
})

Example

const Telegraf = require('telegraf')

const app = new Telegraf(<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()

-Command

command

-Text

text

-In-line mode

inline

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published