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

init io before other wechaty inittiations

上级 95b5aed3
......@@ -26,7 +26,7 @@ const bot = new Wechaty({ profile: 'io-bot' })
bot
.on('login' , user => log.info('Bot', `${user.name()} logined`))
.on('logout' , user => log.info('Bot', `${user.name()} logouted`))
.on('scan' , ({url, code}) => log.info('Bot', `${url}\n[${code}] Scan QR Code in above url to login: `))
.on('scan' , ({url, code}) => log.info('Bot', `[${code}] Scan QR Code in url to login: ${url}`))
.on('message', m => {
m.ready()
.then(onMessage)
......
......@@ -64,16 +64,16 @@ class Wechaty extends EventEmitter {
log.verbose('Wechaty', 'port: %d', this.port)
}
yield this.initPuppet()
yield this.initEventHook()
yield this.puppet.init()
yield this.initIo()
.catch(e => {
.catch(e => { // fail safe
log.error('WechatyIo', 'initIo failed: %s', e.message)
this.emit('error', e)
})
yield this.initPuppet()
yield this.initEventHook()
yield this.puppet.init()
this.inited = true
return this // for chaining
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册