Naltox / telegram-node-bot

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

error TypeError: $.waitForRequest is not a function #117

Closed dleonext closed 8 years ago

dleonext commented 8 years ago

Hello! I'm getting this error that I never got before. I just updated to the newer version of telegram-node-bot.

error TypeError: $.waitForRequest is not a function

class HelloController extends TelegramBaseController {

  helloWorldHandler($){
    $.sendMessage('Hello!');
    $.waitForRequest(($) => {

                var input = $.message.text;
        $.sendMessage("User input " + input);

            });
  }

  get routes() {
    return {
      '/hello' : 'helloWorldHandler'
    }
  }
}

tg.router.
when(['/hello'], new HelloController())

The strange thing is that I can use the $.sendMessage in the same context .

Cheers.

Naltox commented 8 years ago

@dleonext Hi! waitForRequest not a function, its a property, so you must use it like this:

$.waitForRequest
   .then($ => {

   })
dleonext commented 8 years ago

@Naltox thanks for the reply! I think there's a lack of documentation here...

waitForRequest Messages controller scope has waitForRequest method after calling that the next update from current user will be passed to promise.

cheers.