(msg: Api.Message)
| 352 | return; |
| 353 | } |
| 354 | |
| 355 | const installPath = await this.detectInstalledPath(); |
| 356 | const existed = await this.fileExists(`${installPath}/openlist`); |
| 357 | await execAsync(`systemctl stop openlist || true`); |
| 358 | await execAsync(`systemctl disable openlist || true`); |
| 359 | await execAsync(`rm -f /etc/systemd/system/openlist.service || true`); |
| 360 | await execAsync(`systemctl daemon-reload || true`); |
| 361 | if (existed) { |
| 362 | await execAsync(`rm -rf "${installPath}"`); |
| 363 | } |
| 364 | await msg.edit({ text: "已卸载" }); |
| 365 | } catch (error: any) { |
| 366 | await msg.edit({ text: `卸载失败: ${error?.message || error}` }); |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | private async handleBackup(msg: Api.Message) { |
| 371 | try { |
| 372 | const installPath = await this.detectInstalledPath(); |
| 373 | if (!(await this.dirExists(`${installPath}/data`))) { |
| 374 | await msg.edit({ text: `未找到配置目录:${codeTag(`${installPath}/data`)}`, parseMode: "html" }); |
| 375 | return; |
| 376 | } |
| 377 |
no test coverage detected