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

fix missing this of log in io-client

上级 6f302769
/**
* Wechaty - Wechat for Bot
*
* use brolog here is because log in wechaty has to support both nodejs and browser(with electron)
*
*/
// const log = require('npmlog')
const log = require('brolog')
......
......@@ -88,10 +88,10 @@ class IoClient {
this.log.verbose('IoClient', 'initIo()')
if (!this.token) {
log.verbose('IoClient', 'initIo() skiped for no token set')
this.log.verbose('IoClient', 'initIo() skiped for no token set')
return Promise.resolve('no token')
} else {
log.verbose('IoClient', 'initIo(%s)', this.token)
this.log.verbose('IoClient', 'initIo(%s)', this.token)
}
const io = new Io({
......@@ -102,7 +102,7 @@ class IoClient {
return io.init()
.catch(e => {
log.verbose('IoClient', 'initIo() init fail: %s', e.message)
this.log.verbose('IoClient', 'initIo() init fail: %s', e.message)
throw e
})
}
......@@ -132,7 +132,7 @@ class IoClient {
const content = m.toString()
const room = m.room()
// log.info('Bot', '%s<%s>:%s'
// this.log.info('Bot', '%s<%s>:%s'
// , (room ? '['+room.name()+']' : '')
// , from.name()
// , m.toStringDigest()
......@@ -140,7 +140,7 @@ class IoClient {
if (/^wechaty|botie/i.test(m.get('content')) && !bot.self(m)) {
bot.reply(m, 'https://www.wechaty.io')
.then(_ => log.info('Bot', 'REPLIED to magic word "wechaty"'))
.then(_ => this.log.info('Bot', 'REPLIED to magic word "wechaty"'))
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册