提交 130efa6e 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

init Wechaty outside of IoClient

上级 c63fa464
......@@ -71,7 +71,7 @@ export class IoClient {
try {
await this.initIo()
await this.initWechaty(this.options.wechaty as Wechaty)
await this.hookWechaty(this.options.wechaty as Wechaty)
this.state.current('online')
} catch (e) {
log.error('IoClient', 'init() exception: %s', e.message)
......@@ -81,7 +81,7 @@ export class IoClient {
return
}
private async initWechaty(wechaty: Wechaty): Promise<void> {
private async hookWechaty(wechaty: Wechaty): Promise<void> {
log.verbose('IoClient', 'initWechaty()')
if (this.state.target() !== 'online') {
......@@ -96,15 +96,6 @@ export class IoClient {
.on('scan', (url, code) => log.info('IoClient', `[${code}] ${url}`))
.on('message' , msg => this.onMessage(msg))
try {
await wechaty.init()
log.verbose('IoClient', 'wechaty.init() done')
} catch (e) {
log.error('IoClient', 'init() init fail: %s', e)
wechaty.quit()
throw e
}
return
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册