Compare commits

..

1 commit

Author SHA1 Message Date
Take-John 9ad70138d2
Merge b2ab6778b0 into 830c9c2ecd 2024-03-30 17:54:35 +09:00
2 changed files with 4 additions and 9 deletions

View file

@ -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;

View file

@ -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