MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / init

Method init

deepwiki/deepwiki.ts:182–199  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

180 }
181
182 async init(): Promise<void> {
183 const baseDir = createDirectoryInAssets("deepwiki");
184 const mainFile = path.join(baseDir, "config.json");
185 const ctxFile = path.join(baseDir, "context.json");
186
187 this.dbMain = await JSONFilePreset<MainDB>(mainFile, { chats: {}, telegraphToken: "" });
188 await this.dbMain.read();
189 this.dbMain.data ||= { chats: {}, telegraphToken: "" };
190 this.dbMain.data.chats ||= {};
191 this.dbMain.data.telegraphToken ||= "";
192 await this.dbMain.write();
193
194 this.dbCtx = await JSONFilePreset<CtxDB>(ctxFile, { chats: {} });
195 await this.dbCtx.read();
196 this.dbCtx.data ||= { chats: {} };
197 this.dbCtx.data.chats ||= {};
198 await this.dbCtx.write();
199 }
200
201 private ensureReady() {
202 if (!this.dbMain || !this.dbCtx) throw new Error("DeepWikiStore not initialized");

Callers 1

initOnceMethod · 0.45

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected