__main__.py 727 B

12345678910111213141516171819202122232425262728
  1. """Telegram bot"""
  2. from telegram.ext import CommandHandler
  3. from app import LOGGER, UPDATER, commands
  4. from app.conversations.add import ADD_CONV
  5. from app.conversations.remove import REMOVE_CONV
  6. def main():
  7. """Main function"""
  8. LOGGER.info('Start application')
  9. dispatcher = UPDATER.dispatcher
  10. # commands
  11. dispatcher.add_handler(CommandHandler('start', commands.cmd_start))
  12. dispatcher.add_handler(CommandHandler('help', commands.cmd_help))
  13. dispatcher.add_handler(CommandHandler('accounts', commands.cmd_accounts))
  14. # conversations
  15. dispatcher.add_handler(ADD_CONV)
  16. dispatcher.add_handler(REMOVE_CONV)
  17. UPDATER.start_polling()
  18. UPDATER.idle()
  19. if __name__ == '__main__':
  20. main()