Naltox / telegram-node-bot

Node module for creating Telegram bots.
MIT License
721 stars 143 forks source link

getChatMember()? #133

Closed mammad2c closed 7 years ago

mammad2c commented 7 years ago

Hi, getChatMember not working? it sends me promise but relay on Telegram Bot api, must return a chatMember object. and promise is still pending. https://core.telegram.org/bots/api#getchatmember

my code : `'use strict'

const Telegram = require('telegram-node-bot'); const TelegramBaseController = Telegram.TelegramBaseController; const TextCommand = Telegram.TextCommand; const tg = new Telegram.Telegram('token');

class PingController extends TelegramBaseController { /* * @param {Scope} $ / pingHandler($) { $.sendMessage('pong'); var testMember = tg.api.getChatMember($.message.chat.id, $.message.from.id); console.log(testMember) // result : promise {pending} }

get routes() {
    return {
        'pingCommand': 'pingHandler'
    };
}

}

tg.router .when( new TextCommand('ping', 'pingCommand'), new PingController() )`

alxrm commented 7 years ago

Yes, that's actually weird, maybe it's somehow related to the fact, that you use this lib, which returns promise.

And, it's only the assumption, you should probably call .then() to get the result

mammad2c commented 7 years ago

yea, I changed my code and used .then(). tnx