mirror of
https://github.com/syuilo/ai.git
synced 2024-11-12 17:08:00 +00:00
Compare commits
1 commit
7fe378ca50
...
9ad70138d2
Author | SHA1 | Date | |
---|---|---|---|
9ad70138d2 |
|
@ -54,6 +54,7 @@ export default class 藍 {
|
|||
private mentionHooks: MentionHook[] = [];
|
||||
private contextHooks: { [moduleName: string]: ContextHook } = {};
|
||||
private timeoutCallbacks: { [moduleName: string]: TimeoutCallback } = {};
|
||||
public installedModules: { [moduleName: string]: InstalledModule } = {};
|
||||
public db: loki;
|
||||
public lastSleepedAt: number;
|
||||
|
||||
|
|
|
@ -75,16 +75,10 @@ export default abstract class Module {
|
|||
*/
|
||||
@bindThis
|
||||
protected getData() {
|
||||
let doc = this.ai.moduleData.findOne({
|
||||
const doc = this.ai.moduleData.findOne({
|
||||
module: this.name
|
||||
});
|
||||
if (doc == null) {
|
||||
doc = this.ai.moduleData.insertOne({
|
||||
module: this.name,
|
||||
data: {}
|
||||
});
|
||||
}
|
||||
return doc.data;
|
||||
return doc?.data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,7 +124,7 @@ export abstract class InstalledModule<M extends Module = Module, Data = any> imp
|
|||
this.doc = doc;
|
||||
}
|
||||
|
||||
module.installed = this;
|
||||
ai.installedModules[module.name] = this;
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
Loading…
Reference in a new issue