diff --git a/src/io-client.ts b/src/io-client.ts index 20e6c4ac2a7fd0d5e2be9ef4c28494606f1d9044..9292ccf114002a81e07ec70c962c35b64ca08918 100644 --- a/src/io-client.ts +++ b/src/io-client.ts @@ -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 { + private async hookWechaty(wechaty: Wechaty): Promise { 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 }