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

Method initDB

aff/aff.ts:55–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53 aff: this.handleAffCommand.bind(this)
54 };
55
56 // 初始化数据库
57 private async initDB(): Promise<void> {
58 if (this.db) return;
59
60 const dbPath = path.join(
61 createDirectoryInAssets(this.PLUGIN_NAME),
62 "data.json"
63 );
64
65 this.db = await JSONFilePreset<DBData>(dbPath, { affs: [] });
66
67 // 迁移旧数据
68 if (this.db.data.aff) {
69 this.db.data.affs.push(this.db.data.aff);
70 delete this.db.data.aff;
71 await this.db.write();
72 }
73 }
74

Callers 4

setupMethod · 0.95
getAffsMethod · 0.95
addAffMethod · 0.95
removeAffMethod · 0.95

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected