mast / telegram-bot-api

First Telegram Bot API node.js library
http://mast.github.io/telegram-bot-api/
MIT License
246 stars 64 forks source link

Now it Promisify! #18

Closed gumeniukcom closed 8 years ago

gumeniukcom commented 8 years ago
var telegram = require('telegram-bot-api');
var api = new telegram({
    token: '<YOUR TOKEN>'
});

api.getMe()
    .then(function (msg) {
        console.log(msg);
    })
    .catch(function (err) {
        console.log(err);
    });
AliMD commented 8 years ago

:ok_hand: Thank you Is it backward compatible ?

gumeniukcom commented 8 years ago

@AliMD not at all. Some functions, which have callback sintax function(err, data) - should work.

benjick commented 8 years ago

Bump

Callbacks are dead

mast commented 8 years ago

Implemented in 1.0.0. Thank you @ViGo5190 I updated it a bit to make it backwards compatible. So old code should also work with new "promisified" API.