Closed kamikazechaser closed 8 years ago
Hi! Do it like this:
'use strict'
const Telegram = require('telegram-node-bot')
const TelegramBaseController = Telegram.TelegramBaseController
const tg = new Telegram.Telegram('TOKEN')
class PingController extends TelegramBaseController {
/**
* @param {Scope} $
*/
pingHandler($) {
$.sendMessage('pong')
}
get routes() {
return {
'ping': 'pingHandler'
}
}
}
class OtherwiseController extends TelegramBaseController {
handle() {
console.log('otherwise')
}
}
tg.router
.when(['ping'], new PingController())
.otherwise(new OtherwiseController())
I am getting errors when trying to set-up the otherwise controller. What is the correct way of setting up the otherwise controller, say for example to message someone with "command not found". An example would be good.