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

code clean

上级 a8acd3b9
......@@ -70,11 +70,6 @@ export const PUPPET_EVENT_DICT = {
export type PuppetEventName = keyof typeof PUPPET_EVENT_DICT
export interface PuppetOptions {
profile: Profile,
wechaty: Wechaty,
}
export type PuppetContact = typeof Contact & Constructor<{}>
export type PuppetFriendRequest = typeof FriendRequest & Constructor<{}>
export type PuppetMessage = typeof Message & Constructor<{}>
......@@ -87,23 +82,18 @@ export interface PuppetClasses {
Room: PuppetRoom,
}
export interface PuppetOptions {
profile: Profile,
wechaty: Wechaty,
}
/**
* Abstract Puppet Class
*/
export abstract class Puppet extends EventEmitter implements Sayable {
private readonly WATCHDOG_TIMEOUT = 1 * 60 * 1000 // default 1 minute
public readonly state: StateSwitch
public readonly watchdog: Watchdog
public readonly state: StateSwitch
// // tslint:disable-next-line:variable-name
// public readonly Contact: PuppetContact
// // tslint:disable-next-line:variable-name
// public readonly FriendRequest: PuppetFriendRequest
// // tslint:disable-next-line:variable-name
// public readonly Message: PuppetMessage
// // tslint:disable-next-line:variable-name
// public readonly Room: PuppetRoom
protected readonly watchdog: Watchdog
private readonly pkg: NpmPackage
......@@ -113,8 +103,10 @@ export abstract class Puppet extends EventEmitter implements Sayable {
) {
super()
this.state = new StateSwitch('Puppet', log)
this.watchdog = new Watchdog(this.WATCHDOG_TIMEOUT, 'Puppet')
const WATCHDOG_TIMEOUT = 1 * 60 * 1000 // default 1 minute
this.state = new StateSwitch('AbstractPuppet', log)
this.watchdog = new Watchdog(WATCHDOG_TIMEOUT, 'Puppet')
/**
* 1. Check Classes for inherience correctly
......
......@@ -24,13 +24,11 @@ import {
PuppetOptions,
RoomQueryFilter,
} from '../abstract-puppet/'
} from '../abstract-puppet/'
import {
log,
} from '../config'
import {
} from '../message'
} from '../config'
import MockContact from './mock-contact'
import MockFriendRequest from './mock-friend-request'
......
......@@ -35,21 +35,21 @@ import {
log,
VERSION,
} from './'
} from './'
import {
Puppet,
} from './abstract-puppet/'
} from './abstract-puppet/'
test('Export of the Framework', async t => {
t.ok(Contact , 'should export Contact')
t.ok(FriendRequest, 'should export FriendREquest')
t.ok(IoClient , 'should export IoClient')
t.ok(Message , 'should export Message')
t.ok(Puppet , 'should export Puppet')
t.ok(Room , 'should export Room')
t.ok(Wechaty , 'should export Wechaty')
t.ok(log , 'should export log')
t.ok(Contact , 'should export Contact')
t.ok(FriendRequest , 'should export FriendREquest')
t.ok(IoClient , 'should export IoClient')
t.ok(Message , 'should export Message')
t.ok(Puppet , 'should export Puppet')
t.ok(Room , 'should export Room')
t.ok(Wechaty , 'should export Wechaty')
t.ok(log , 'should export log')
const bot = Wechaty.instance()
t.is(bot.version(true), require('../package.json').version,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册