node-telegram-api/README.md
Mahdi Dibaiee ffce3644b7 Better now
2015-07-04 04:07:40 +04:30

1.6 KiB

Telegram Bots

Create and control Telegram bots easily using the new 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.

npm install telegram-api

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

Documentation

Example

var Bot = require('telegram-api');
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');

  bot.send(welcome);
});

Bots using this module

@JavaScriptBot => mdibaiee/javascriptbot

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