Closed MaximBatanov closed 8 years ago
@MaximBatanov Hi! What version of module you are using? And can you show your router?
Version: 3.0.4
@MaximBatanov Try to update, if that does not help show me your router please.
Version: 3.0.7 - the same error. My controller: class AnyController extends Telegram.TelegramBaseController { anyHandler( $ ) { console.log( JSON.stringify($.message) ); } get routes() { return { 'any': 'anyHandler', } } } bot.router.any( new AnyController() );
@MaximBatanov Any controllers cant have routes
@MaximBatanov use that like this:
class AnyController extends Telegram.TelegramBaseController {
handle($) {
//handle all messages here
}
}
tg.router
.any(new AnyController())
Thanks. It's work.
error TypeError: Cannot read property 'toString' of undefined at OtherwiseController.methodForCommand (.../TelegramBaseController.js:59:34) at controllers.forEach.e (.../MessageUpdateProcessor.js:63:44) at Array.forEach (native) at _getSession.then.session (.../MessageUpdateProcessor.js:54:33) at process._tickCallback (internal/process/next_tick.js:103:7)
I added a quick fix: (TelegramRouter.js) commandNameForUpdate(update) { /code here/ if( this._otherwiseController ) return 'otherwise'; else if( this._anyController ) return 'any'; }