ai/src/module.ts
2019-01-24 17:47:13 +09:00

30 lines
612 B
TypeScript

import autobind from 'autobind-decorator';
import , { InstallerResult } from './ai';
export default abstract class Module {
public abstract readonly name: string;
protected ai: ;
public init(ai: ) {
this.ai = ai;
}
public abstract install(): InstallerResult;
@autobind
protected log(msg: string) {
this.ai.log(`[${this.name}]: ${msg}`);
}
@autobind
protected subscribeReply(key: string, isDm: boolean, id: string, data?: any) {
this.ai.subscribeReply(this, key, isDm, id, data);
}
@autobind
protected unsubscribeReply(key: string) {
this.ai.unsubscribeReply(this, key);
}
}