Deprecated: A simple API to create and control Telegram bots
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Mahdi Dibaiee b64b6f7ee8 4.2.0 4 years ago
src Merge pull request #47 from laurynas-karvelis/feature/prevent-event-listener-overflow 4 years ago
.babelrc refactor: remove grunt and babel 7 years ago
.eslintrc chore(lint): update eslint configuration, re-lint 7 years ago
.gitignore chore(lint): update eslint configuration, re-lint 7 years ago
Gruntfile.js feat(API): add previous API 7 years ago
LICENSE Initial commit 7 years ago
README.md chore: remove unnecessary stuff 5 years ago
demo.gif smaller GIF 7 years ago
demo.js feat(API): add previous API 7 years ago
esdoc.json V2 - Big update 7 years ago
hand-glow.jpg Fix #8 7 years ago
package.json 4.2.0 4 years ago

README.md

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