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

code clean

上级 99f8698a
...@@ -161,8 +161,7 @@ async function onLogin( ...@@ -161,8 +161,7 @@ async function onLogin(
log.warn('PuppetPuppeteerEvent', 'readyStable() exception: %s', e && e.message || e) log.warn('PuppetPuppeteerEvent', 'readyStable() exception: %s', e && e.message || e)
} }
this.login(user) this.login(userId)
// this.emit('login', user)
} catch (e) { } catch (e) {
log.error('PuppetPuppeteerEvent', 'onLogin() exception: %s', e) log.error('PuppetPuppeteerEvent', 'onLogin() exception: %s', e)
......
...@@ -569,10 +569,10 @@ export class PuppetPuppeteer extends Puppet { ...@@ -569,10 +569,10 @@ export class PuppetPuppeteer extends Puppet {
} }
} }
public async login(user: Contact): Promise<void> { public async login(userId: string): Promise<void> {
log.warn('PuppetPuppeteer', 'login(%s)', user) log.verbose('PuppetPuppeteer', 'login(%s)', userId)
this.userId = user.id this.userId = userId
this.emit('login', user) this.emit('login', this.Contact.load(userId))
} }
/** /**
......
...@@ -63,7 +63,7 @@ const puppet = new PuppetPuppeteer({ ...@@ -63,7 +63,7 @@ const puppet = new PuppetPuppeteer({
(wechaty as any).initPuppetAccessory(puppet) (wechaty as any).initPuppetAccessory(puppet)
const MOCK_USER_ID = 'TEST-USER-ID' const MOCK_USER_ID = 'TEST-USER-ID'
puppet.login(wechaty.Contact.load(MOCK_USER_ID)) puppet.login(MOCK_USER_ID)
test('constructor()', async t => { test('constructor()', async t => {
/* tslint:disable:max-line-length */ /* tslint:disable:max-line-length */
......
...@@ -424,7 +424,7 @@ export class Wechaty extends PuppetAccessory implements Sayable { ...@@ -424,7 +424,7 @@ export class Wechaty extends PuppetAccessory implements Sayable {
log.verbose('Wechaty', 'initPuppet()') log.verbose('Wechaty', 'initPuppet()')
if (!this.options.puppet) { if (!this.options.puppet) {
log.warn('Wechaty', 'initPuppet() using default puppet: %s', config.puppet) log.info('Wechaty', 'initPuppet() using default puppet: %s', config.puppet)
this.options.puppet = config.puppet this.options.puppet = config.puppet
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册