| 351 | } |
| 352 | |
| 353 | private async handleExport(msg: Api.Message) { |
| 354 | if (this.config.channelList.length === 0) { |
| 355 | await msg.edit({ text: "没有可导出的频道。" }); |
| 356 | return; |
| 357 | } |
| 358 | const backupContent = this.config.channelList.map((c) => c.handle).join("\n"); |
| 359 | const backupFilePath = path.join(process.cwd(), "temp", "so_channels_backup.txt"); |
| 360 | await fs.mkdir(path.dirname(backupFilePath), { recursive: true }); |
| 361 | await fs.writeFile(backupFilePath, backupContent); |
| 362 | await this.client.sendFile(msg.chatId!, { file: backupFilePath, caption: `✅ 您的频道源已导出。`, replyTo: msg }); |
| 363 | await fs.unlink(backupFilePath); |
| 364 | } |
| 365 | |
| 366 | private async handleImport(msg: Api.Message) { |
| 367 | const replied = await safeGetReplyMessage(msg); |