4.2.0 • Published 5 years ago

telegram-api v4.2.0

Weekly downloads
24
License
MIT
Repository
github
Last release
5 years ago

Telegram Bots

Create and control Telegram bots easily using the new Telegram API.

npm install telegram-api

telegram-api is in beta, your feedback is appreciated, please fill an issue for any bugs you find or any suggestions you have.

If you are cloning this repository, remember to run npm install to install dependencies.

If you are looking for a real-life example of a bot written using this module, see mdibaiee/webdevrobot.

Documentation

Example

// ES6:
import Bot, { Message, File } from 'telegram-api';

// ES5:
var Bot = require('telegram-api').default;
var Message = require('telegram-api/types/Message');
var File = require('telegram-api/types/File');

var bot = new Bot({
  token: 'YOUR_TOKEN'
});

bot.start();

bot.get(/Hi|Hey|Hello|Yo/, function(message) {
  var answer = new Message().text('Hello, Sir').to(message.chat.id);

  bot.send(answer);
});

bot.command('start', function(message) {
  var welcome = new File().file('./some_photo.png').caption('Welcome').to(message.chat.id);

  bot.send(welcome);
});

// Arguments, see: https://github.com/mdibaiee/node-telegram-api/wiki/Commands
bot.command('weather <city> [date]', function(message) {
  console.log(message.args.city, message.args.date);
})

Todo

  • Webhook support (not tested, see #4)
  • Forward Type
  • BulkMessage Type
  • File Type
  • Sticker Type
  • Location Type
  • Contact Type
  • Allow remote control of bots (TCP maybe)
  • YOUR IDEAS! Fill an issue
4.2.0

5 years ago

4.1.0

6 years ago

4.0.0

6 years ago

3.1.1

6 years ago

3.1.0

6 years ago

3.0.0

6 years ago

2.0.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.9.1

6 years ago

0.9.0

7 years ago

0.8.0

7 years ago

0.7.9

7 years ago

0.7.8

7 years ago

0.7.7

7 years ago

0.7.6

8 years ago

0.7.5

8 years ago

0.7.4

8 years ago

0.7.3

8 years ago

0.7.2

8 years ago

0.7.1

8 years ago

0.7.0

8 years ago

0.6.1

8 years ago

0.6.0

9 years ago

0.5.22

9 years ago

0.5.21

9 years ago

0.5.20

9 years ago

0.5.12

9 years ago

0.5.11

9 years ago

0.5.10

9 years ago

0.5.0

9 years ago

0.4.72

9 years ago

0.4.71

9 years ago

0.4.70

9 years ago

0.4.65

9 years ago

0.4.64

9 years ago

0.4.63

9 years ago

0.4.62

9 years ago

0.4.61

9 years ago

0.4.6

9 years ago

0.4.5

9 years ago

0.4.4

9 years ago

0.4.3

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.5

9 years ago

0.3.4

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago