(msg: Api.Message, isGlobal: boolean)
| 177 | } |
| 178 | |
| 179 | private async cancelAutoDelSetting(msg: Api.Message, isGlobal: boolean): Promise<void> { |
| 180 | const chatId = isGlobal ? "0" : msg.peerId.toString(); |
| 181 | |
| 182 | if (!this.settings.has(chatId)) { |
| 183 | await msg.edit({ |
| 184 | text: "❌ 未开启自动删除" |
| 185 | }); |
| 186 | return; |
| 187 | } |
| 188 | |
| 189 | this.settings.delete(chatId); |
| 190 | |
| 191 | if (this.db) { |
| 192 | try { |
| 193 | this.db.prepare("DELETE FROM autodel_settings WHERE chat_id = ?").run(chatId); |
| 194 | } catch (error) { |
| 195 | console.error("Failed to delete setting:", error); |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | await msg.edit({ |
| 200 | text: "✅ 取消自动删除任务成功。" |
| 201 | }); |
| 202 | } |
| 203 | |
| 204 | private async setAutoDelSetting(msg: Api.Message, seconds: number, isGlobal: boolean): Promise<void> { |
| 205 | const chatId = isGlobal ? "0" : msg.peerId.toString(); |
no test coverage detected