Naltox / telegram-node-bot

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

.otherwise (Cannot read property 'toString' of undefined) #99

Closed TemaSM closed 7 years ago

TemaSM commented 8 years ago

Found bug with TelegramRouter().otherwise(controller) method.

Function argument controller is instance of class TelegramBaseController, which has function methodForCommand() implemented for binding commands -> routes -> actions.

So, when we call tg.router.otherwise(new OtherwiseController()), if statement on TelegramBaseController.js#L59 will fire TypeError: Cannot read property 'toString' of undefined, because as argument to .otherwise() we provided object of Controller, not an command param of string type, that's why command.toString() firing Error.

Gonna fix it today & send PR :ok_hand:

xiaoziguys commented 8 years ago

i had the same problem