(key: string, value: string)
| 56 | |
| 57 | // 直接从顶级键读取 |
| 58 | const value = this.db.data[key]; |
| 59 | return value ?? defaultValue ?? DEFAULT_CONFIG[key] ?? ""; |
| 60 | } |
| 61 | |
| 62 | static async set(key: string, value: string): Promise<boolean> { |
| 63 | await this.init(); |
| 64 | if (!this.db) return false; |
| 65 | |
| 66 | try { |
| 67 | this.db.data[key] = value; |
| 68 | await this.db.write(); |
| 69 | return true; |
| 70 | } catch (error) { |
| 71 | console.error(`[sticker] 设置配置失败 ${key}:`, error); |
| 72 | return false; |
| 73 | } |
no test coverage detected