(texts: string[])
| 219 | |
| 220 | static async saveRandomTexts(texts: string[]): Promise<boolean> { |
| 221 | await this.init(); |
| 222 | try { |
| 223 | this.db!.data.random_texts = texts.slice(0, 100) |
| 224 | .filter((t): t is string => Boolean(t) && typeof t === 'string') |
| 225 | .map(t => t.trim()) |
| 226 | .filter(t => t.length > 0 && t.length <= 50); |
| 227 | await this.db!.write(); |
| 228 | return true; |
| 229 | } catch { return false; } |
| 230 | } |
| 231 | |
| 232 | static async getAllEnabledUsers(): Promise<number[]> { |
| 233 | await this.init(); |
| 234 | const users = this.db?.data?.users ?? {}; |
no test coverage detected