mirror of
https://github.com/syuilo/ai.git
synced 2024-11-14 01:37:59 +00:00
Compare commits
1 commit
ed2e3b5ff8
...
f078a88547
Author | SHA1 | Date | |
---|---|---|---|
f078a88547 |
|
@ -4,11 +4,11 @@ import 藍, { InstallerResult } from '@/ai.js';
|
||||||
export default abstract class Module {
|
export default abstract class Module {
|
||||||
public abstract readonly name: string;
|
public abstract readonly name: string;
|
||||||
|
|
||||||
private maybeAi?: 藍;
|
protected ai: 藍;
|
||||||
private doc: any;
|
private doc: any;
|
||||||
|
|
||||||
public init(ai: 藍) {
|
public init(ai: 藍) {
|
||||||
this.maybeAi = ai;
|
this.ai = ai;
|
||||||
|
|
||||||
this.doc = this.ai.moduleData.findOne({
|
this.doc = this.ai.moduleData.findOne({
|
||||||
module: this.name
|
module: this.name
|
||||||
|
@ -24,13 +24,6 @@ export default abstract class Module {
|
||||||
|
|
||||||
public abstract install(): InstallerResult;
|
public abstract install(): InstallerResult;
|
||||||
|
|
||||||
protected get ai(): 藍 {
|
|
||||||
if (this.maybeAi == null) {
|
|
||||||
throw new TypeError('This module has not been initialized');
|
|
||||||
}
|
|
||||||
return this.maybeAi;
|
|
||||||
}
|
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
protected log(msg: string) {
|
protected log(msg: string) {
|
||||||
this.ai.log(`[${this.name}]: ${msg}`);
|
this.ai.log(`[${this.name}]: ${msg}`);
|
||||||
|
|
Loading…
Reference in a new issue