1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- # -*- coding: utf-8 -*-
- from demeter.core import *
- class Vecan(object):
- def init(self):
- print('''
- ********************************************************
- * vecan-robot - 神算终端机器人 *
- * (c) 201(c) 2019 rabin <rabin@dever.cc> *
- * https://github.com/shemic/vecan.git *
- ********************************************************
- 如需退出,可以按 Ctrl-4 组合键。
- ''')
- Demeter.initConfig()
- self.config()
- self.robot = Demeter.service('robot')
- self.robot.init(profiling=Demeter.option['profiling'], logout=Demeter.option['logout'])
- #self.robot.say('亲爱的,我是神算终端机器人vecan,很高兴为你服务', True, completed=lambda: self.robot.wait())
- #self.robot.say('亲爱的,我是神算终端机器人vecan,很高兴为你服务', True)
- self.robot.wait()
- Demeter.dog = WatchDog.init()
- def config(self):
- if 'vecan' not in Demeter.config:
- Demeter.config['vecan'] = {}
- if 'data' not in Demeter.config['vecan']:
- Demeter.config['vecan']['data'] = File.runtime('data')
- if 'temp' not in Demeter.config['vecan']:
- Demeter.config['vecan']['temp'] = File.runtime('temp')
- if 'outname' not in Demeter.config['vecan']:
- Demeter.config['vecan']['outname'] = 'output'
- self.opt()
- def opt(self):
- param = {}
- param['profiling'] = 'p'
- param['logout'] = 'l'
- Demeter.getopt(param)
- if 'profiling' not in Demeter.option:
- Demeter.option['profiling'] = False
- if 'logout' not in Demeter.option:
- Demeter.option['logout'] = True
- def run(self):
- self.init()
- signal.signal(signal.SIGINT, self.robot.sleep)
- #Demeter.webInit('front')
- if __name__ == '__main__':
- vecan = Vecan()
- vecan.run()
|