You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
794B

  1. # encoding:utf-8
  2. import os
  3. from config import conf, load_config
  4. from channel import channel_factory
  5. from common.log import logger
  6. from plugins import *
  7. def run():
  8. try:
  9. # load config
  10. load_config()
  11. # create channel
  12. channel_name=conf().get('channel_type', 'wx')
  13. if channel_name == 'wxy':
  14. os.environ['WECHATY_LOG']="warn"
  15. # os.environ['WECHATY_PUPPET_SERVICE_ENDPOINT'] = '127.0.0.1:9001'
  16. channel = channel_factory.create_channel(channel_name)
  17. if channel_name in ['wx','wxy']:
  18. PluginManager().load_plugins()
  19. # startup channel
  20. channel.startup()
  21. except Exception as e:
  22. logger.error("App startup failed!")
  23. logger.exception(e)
  24. if __name__ == '__main__':
  25. run()