mirror of
https://github.com/syuilo/ai.git
synced 2024-11-14 01:37:59 +00:00
30 lines
612 B
TypeScript
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);
|
|
}
|
|
}
|