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

Method init

autochangename/autochangename.ts:187–198  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

185
186 private static async init(): Promise<void> {
187 if (this.db) return;
188 if (this.initPromise) return this.initPromise;
189
190 this.initPromise = (async () => {
191 const dbPath = path.join(createDirectoryInAssets("autochangename"), "autochangename.json");
192 this.db = await JSONFilePreset<ConfigData>(dbPath, { users: {}, random_texts: [] });
193 console.log("[AutoChangeName] 数据库初始化成功");
194 })();
195
196 return this.initPromise;
197 }
198
199 static async getUserSettings(userId: number): Promise<UserSettings | null> {
200 if (!userId || isNaN(userId)) return null;
201 await this.init();

Callers 6

getUserSettingsMethod · 0.95
saveUserSettingsMethod · 0.95
getRandomTextsMethod · 0.95
saveRandomTextsMethod · 0.95
getAllEnabledUsersMethod · 0.95
autochangename.tsFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected