Deprecated: A simple API to create and control Telegram bots
Go to file
Ali Movahedi 55b89482b4 chore: update .gitignore and package.json
add build and types folder into .gitignore
remove index.js from files in package.json
2016-03-28 12:41:40 +04:30
build style: lint code 2016-03-28 12:30:54 +04:30
src style: lint code 2016-03-28 12:30:54 +04:30
types feat(API): add previous API 2016-03-28 12:35:56 +04:30
.babelrc refactor: remove grunt and babel 2016-03-28 12:26:07 +04:30
.eslintrc refactor: remove grunt and babel 2016-03-28 12:26:07 +04:30
.gitignore chore: update .gitignore and package.json 2016-03-28 12:41:40 +04:30
demo.gif smaller GIF 2015-06-27 04:50:25 +04:30
demo.js feat(API): add previous API 2016-03-28 12:35:56 +04:30
esdoc.json V2 - Big update 2015-06-29 03:12:48 +04:30
Gruntfile.js feat(API): add previous API 2016-03-28 12:35:56 +04:30
hand-glow.jpg Fix #8 2015-07-27 09:25:27 +04:30
LICENSE Initial commit 2015-06-26 03:04:01 +04:30
package.json chore: update .gitignore and package.json 2016-03-28 12:41:40 +04:30
README.md chore: README 2016-03-28 12:37:53 +04:30

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);
})

Bots using this module

@webdevrobot => mdibaiee/webdevrobot

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