telegram-promise
v1.2.1
Published
Simple Telegram Bot API
Downloads
16
Maintainers
Readme
telegram-promise
This is a simple implementation of Telegram Bot API.
Key features:
- ES2015
- Promise based
- Easy customizable
- Bot API 2.0
Supports Node.js versions greater than 4.
What isn't included:
- Handling updates (webhook or long polling). It is business of your application.
Installation
$ npm install telegram-promise --save
Usage
const TelegramBotAPI = require('telegram-promise');
const api = new TelegramBotAPI(ACCESS_TOKEN);
api.getMe()
.then(res => {
console.log(res.result);
})
.catch(err => {
console.error(err);
});
api.sendPhoto({
chat_id: CHAT_ID,
photo: fs.createReadStream('cats.png'),
})
.then(res => {
console.log('Done!');
})
.catch(err => {
console.log('Error:', err);
});
API
Module API follows the official Telegram Bot API: https://core.telegram.org/bots/api
Implemented API verion: April 9, 2016 Bot API 2.0
All methods have the last parameter options
. It can be used for request customization. See more: node-fetch.
More info
- Telegram Bot API 2.0
- Telegram Bot API
- Telegram Bot API changelog
- ECMAScript® 2015 Language Specification
- A detailed overview of ECMAScript 6 features
- Promise
- Classes
License
MIT