Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Telegram = require('telegram-node-bot');
- const TelegramBaseController = Telegram.TelegramBaseController;
- const TextCommand = Telegram.TextCommand;
- const Config = require('./config');
- const tg = new Telegram.Telegram(Config.Telegram.token, {
- workers : 1
- });
- const StartController = require('./controller/StartController');
- const OtherwiseController = require('./controller/OtherwiseController');
- const PingController = require('./controller/PingController');
- tg.router
- .when(new TextCommand('/start', 'startHandler'), new StartController())
- .when(new TextCommand('ping', 'pingCommand'),new PingController())
- //.when(new TextCommand('/stop'), new StopController())
- //.when(new TextCommand('/restart'), new RestartController())
- .otherwise(new OtherwiseController());
- tg.onMain(() => {
- //this code will be executed one time on main proccess
- console.log('hello');
- })
Advertisement
Add Comment
Please, Sign In to add comment