Guest User

Untitled

a guest
Oct 4th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. const Telegram = require('telegram-node-bot');
  2. const TelegramBaseController = Telegram.TelegramBaseController;
  3. const TextCommand = Telegram.TextCommand;
  4. const Config = require('./config');
  5. const tg = new Telegram.Telegram(Config.Telegram.token, {
  6. workers : 1
  7. });
  8. const StartController = require('./controller/StartController');
  9. const OtherwiseController = require('./controller/OtherwiseController');
  10. const PingController = require('./controller/PingController');
  11.  
  12. tg.router
  13. .when(new TextCommand('/start', 'startHandler'), new StartController())
  14. .when(new TextCommand('ping', 'pingCommand'),new PingController())
  15. //.when(new TextCommand('/stop'), new StopController())
  16. //.when(new TextCommand('/restart'), new RestartController())
  17. .otherwise(new OtherwiseController());
  18.  
  19. tg.onMain(() => {
  20. //this code will be executed one time on main proccess
  21. console.log('hello');
  22. })
Advertisement
Add Comment
Please, Sign In to add comment