()
| 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(); |
no outgoing calls
no test coverage detected