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

code clean

上级 b488cfb5
......@@ -161,7 +161,7 @@ export class Bridge extends PadchatRpc {
log.silly('PuppetPadchatBridge', 'start() on(logout, %s)', data)
if (this.selfId) {
this.selfId = undefined
this.emit('logout', data)
this.logout()
} else {
log.warn('PuppetPadchatBridge', 'start() on(logout) received `logout` event when no `selfId`')
}
......@@ -199,6 +199,8 @@ export class Bridge extends PadchatRpc {
}
protected async login(username: string): Promise<void> {
log.verbose('PuppetPadchatBridge', `login(%s)`, username)
if (this.selfId) {
throw new Error('username exist')
}
......@@ -211,7 +213,9 @@ export class Bridge extends PadchatRpc {
this.emit('login', this.selfId)
}
public logout(): void {
public async logout(): Promise<void> {
log.verbose('PuppetPadchatBridge', `logout()`)
if (!this.selfId) {
// throw new Error('no username')
log.warn('PuppetPadchatBridge', 'logout() selfId not exist, already logout-ed')
......@@ -221,6 +225,8 @@ export class Bridge extends PadchatRpc {
this.selfId = undefined
this.releaseCache()
this.emit('logout')
this.startLogin()
}
......
......@@ -635,6 +635,8 @@ export abstract class Puppet extends EventEmitter implements Sayable {
public abstract async roomTopic(roomId: string, topic: string) : Promise<void>
public abstract async roomTopic(roomId: string, topic?: string) : Promise<string | void>
public abstract async roomQrCode(roomId: string) : Promise<string>
public abstract async roomList() : Promise<string[]>
public abstract async roomMemberList(roomId: string) : Promise<string[]>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册