mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-05-12 00:49:43 +08:00
feat: implement transfer command for file transfers between storages
This commit is contained in:
@@ -31,6 +31,7 @@ const (
|
||||
BotMsgCmdStorage Key = "bot.msg.cmd.storage"
|
||||
BotMsgCmdSyncpeers Key = "bot.msg.cmd.syncpeers"
|
||||
BotMsgCmdTask Key = "bot.msg.cmd.task"
|
||||
BotMsgCmdTransfer Key = "bot.msg.cmd.transfer"
|
||||
BotMsgCmdUnwatch Key = "bot.msg.cmd.unwatch"
|
||||
BotMsgCmdUpdate Key = "bot.msg.cmd.update"
|
||||
BotMsgCmdWatch Key = "bot.msg.cmd.watch"
|
||||
@@ -106,20 +107,6 @@ const (
|
||||
BotMsgDlInfoFilesSelectStorage Key = "bot.msg.dl.info_files_select_storage"
|
||||
BotMsgDlUsage Key = "bot.msg.dl.usage"
|
||||
BotMsgHelpTextFmt Key = "bot.msg.help_text_fmt"
|
||||
BotMsgImportErrorAddTaskFailed Key = "bot.msg.import.error_add_task_failed"
|
||||
BotMsgImportErrorInvalidChatId Key = "bot.msg.import.error_invalid_chat_id"
|
||||
BotMsgImportErrorInvalidRegex Key = "bot.msg.import.error_invalid_regex"
|
||||
BotMsgImportErrorListFilesFailed Key = "bot.msg.import.error_list_files_failed"
|
||||
BotMsgImportErrorNoFilesToImport Key = "bot.msg.import.error_no_files_to_import"
|
||||
BotMsgImportErrorNoTargetChatId Key = "bot.msg.import.error_no_target_chat_id"
|
||||
BotMsgImportErrorNoTelegramStorage Key = "bot.msg.import.error_no_telegram_storage"
|
||||
BotMsgImportErrorStorageNotFound Key = "bot.msg.import.error_storage_not_found"
|
||||
BotMsgImportErrorStorageNotListable Key = "bot.msg.import.error_storage_not_listable"
|
||||
BotMsgImportErrorStorageNotReadable Key = "bot.msg.import.error_storage_not_readable"
|
||||
BotMsgImportInfoFetchingFiles Key = "bot.msg.import.info_fetching_files"
|
||||
BotMsgImportInfoTaskAdded Key = "bot.msg.import.info_task_added"
|
||||
BotMsgImportStartStats Key = "bot.msg.import.start_stats"
|
||||
BotMsgImportUsage Key = "bot.msg.import.usage"
|
||||
BotMsgMediaGroupErrorBuildStorageSelectKeyboardFailed Key = "bot.msg.media_group.error_build_storage_select_keyboard_failed"
|
||||
BotMsgMediaGroupInfoGroupFoundFilesSelectStorage Key = "bot.msg.media_group.info_group_found_files_select_storage"
|
||||
BotMsgMediaGroupInfoSavingFiles Key = "bot.msg.media_group.info_saving_files"
|
||||
@@ -164,20 +151,6 @@ const (
|
||||
BotMsgProgressFileProcessingPrefix Key = "bot.msg.progress.file_processing_prefix"
|
||||
BotMsgProgressFileSizePrefix Key = "bot.msg.progress.file_size_prefix"
|
||||
BotMsgProgressFileStartPrefix Key = "bot.msg.progress.file_start_prefix"
|
||||
BotMsgProgressImportAvgSpeedPrefix Key = "bot.msg.progress.import_avg_speed_prefix"
|
||||
BotMsgProgressImportElapsedTimePrefix Key = "bot.msg.progress.import_elapsed_time_prefix"
|
||||
BotMsgProgressImportFailedFilesPrefix Key = "bot.msg.progress.import_failed_files_prefix"
|
||||
BotMsgProgressImportFailedPrefix Key = "bot.msg.progress.import_failed_prefix"
|
||||
BotMsgProgressImportProcessingMore Key = "bot.msg.progress.import_processing_more"
|
||||
BotMsgProgressImportProcessingPrefix Key = "bot.msg.progress.import_processing_prefix"
|
||||
BotMsgProgressImportProgressPrefix Key = "bot.msg.progress.import_progress_prefix"
|
||||
BotMsgProgressImportRemainingTimePrefix Key = "bot.msg.progress.import_remaining_time_prefix"
|
||||
BotMsgProgressImportSpeedPrefix Key = "bot.msg.progress.import_speed_prefix"
|
||||
BotMsgProgressImportStartPrefix Key = "bot.msg.progress.import_start_prefix"
|
||||
BotMsgProgressImportSuccessPrefix Key = "bot.msg.progress.import_success_prefix"
|
||||
BotMsgProgressImportTotalFilesPrefix Key = "bot.msg.progress.import_total_files_prefix"
|
||||
BotMsgProgressImportTotalSizePrefix Key = "bot.msg.progress.import_total_size_prefix"
|
||||
BotMsgProgressImportUploadedPrefix Key = "bot.msg.progress.import_uploaded_prefix"
|
||||
BotMsgProgressParsedDonePrefix Key = "bot.msg.progress.parsed_done_prefix"
|
||||
BotMsgProgressParsedStartPrefix Key = "bot.msg.progress.parsed_start_prefix"
|
||||
BotMsgProgressProcessingListPrefix Key = "bot.msg.progress.processing_list_prefix"
|
||||
@@ -190,6 +163,20 @@ const (
|
||||
BotMsgProgressTelegraphProgressPrefix Key = "bot.msg.progress.telegraph_progress_prefix"
|
||||
BotMsgProgressTelegraphStartPrefix Key = "bot.msg.progress.telegraph_start_prefix"
|
||||
BotMsgProgressTotalSizePrefix Key = "bot.msg.progress.total_size_prefix"
|
||||
BotMsgProgressTransferAvgSpeedPrefix Key = "bot.msg.progress.transfer_avg_speed_prefix"
|
||||
BotMsgProgressTransferElapsedTimePrefix Key = "bot.msg.progress.transfer_elapsed_time_prefix"
|
||||
BotMsgProgressTransferFailedFilesPrefix Key = "bot.msg.progress.transfer_failed_files_prefix"
|
||||
BotMsgProgressTransferFailedPrefix Key = "bot.msg.progress.transfer_failed_prefix"
|
||||
BotMsgProgressTransferProcessingMore Key = "bot.msg.progress.transfer_processing_more"
|
||||
BotMsgProgressTransferProcessingPrefix Key = "bot.msg.progress.transfer_processing_prefix"
|
||||
BotMsgProgressTransferProgressPrefix Key = "bot.msg.progress.transfer_progress_prefix"
|
||||
BotMsgProgressTransferRemainingTimePrefix Key = "bot.msg.progress.transfer_remaining_time_prefix"
|
||||
BotMsgProgressTransferSpeedPrefix Key = "bot.msg.progress.transfer_speed_prefix"
|
||||
BotMsgProgressTransferStartPrefix Key = "bot.msg.progress.transfer_start_prefix"
|
||||
BotMsgProgressTransferSuccessPrefix Key = "bot.msg.progress.transfer_success_prefix"
|
||||
BotMsgProgressTransferTotalFilesPrefix Key = "bot.msg.progress.transfer_total_files_prefix"
|
||||
BotMsgProgressTransferTotalSizePrefix Key = "bot.msg.progress.transfer_total_size_prefix"
|
||||
BotMsgProgressTransferUploadedPrefix Key = "bot.msg.progress.transfer_uploaded_prefix"
|
||||
BotMsgProgressYtdlpDone Key = "bot.msg.progress.ytdlp_done"
|
||||
BotMsgProgressYtdlpDownloading Key = "bot.msg.progress.ytdlp_downloading"
|
||||
BotMsgProgressYtdlpStart Key = "bot.msg.progress.ytdlp_start"
|
||||
@@ -245,6 +232,20 @@ const (
|
||||
BotMsgTelegraphInfoPicCountPrefix Key = "bot.msg.telegraph.info_pic_count_prefix"
|
||||
BotMsgTelegraphInfoPromptSelectStorage Key = "bot.msg.telegraph.info_prompt_select_storage"
|
||||
BotMsgTelegraphInfoTitlePrefix Key = "bot.msg.telegraph.info_title_prefix"
|
||||
BotMsgTransferErrorAddTaskFailed Key = "bot.msg.transfer.error_add_task_failed"
|
||||
BotMsgTransferErrorInvalidRegex Key = "bot.msg.transfer.error_invalid_regex"
|
||||
BotMsgTransferErrorInvalidSource Key = "bot.msg.transfer.error_invalid_source"
|
||||
BotMsgTransferErrorInvalidTarget Key = "bot.msg.transfer.error_invalid_target"
|
||||
BotMsgTransferErrorListFilesFailed Key = "bot.msg.transfer.error_list_files_failed"
|
||||
BotMsgTransferErrorNoFilesToTransfer Key = "bot.msg.transfer.error_no_files_to_transfer"
|
||||
BotMsgTransferErrorStorageNotFound Key = "bot.msg.transfer.error_storage_not_found"
|
||||
BotMsgTransferErrorStorageNotListable Key = "bot.msg.transfer.error_storage_not_listable"
|
||||
BotMsgTransferErrorStorageNotReadable Key = "bot.msg.transfer.error_storage_not_readable"
|
||||
BotMsgTransferErrorTargetNotFound Key = "bot.msg.transfer.error_target_not_found"
|
||||
BotMsgTransferInfoFetchingFiles Key = "bot.msg.transfer.info_fetching_files"
|
||||
BotMsgTransferInfoTaskAdded Key = "bot.msg.transfer.info_task_added"
|
||||
BotMsgTransferStartStats Key = "bot.msg.transfer.start_stats"
|
||||
BotMsgTransferUsage Key = "bot.msg.transfer.usage"
|
||||
BotMsgUpdateButtonUpgrade Key = "bot.msg.update.button_upgrade"
|
||||
BotMsgUpdateErrorCheckLatestFailed Key = "bot.msg.update.error_check_latest_failed"
|
||||
BotMsgUpdateErrorNoReleaseFound Key = "bot.msg.update.error_no_release_found"
|
||||
|
||||
@@ -54,6 +54,7 @@ bot:
|
||||
aria2dl: "Download files using Aria2"
|
||||
ytdlp: "Download video/audio using yt-dlp"
|
||||
import: "Import files from storage to Telegram"
|
||||
transfer: "Transfer files between storages"
|
||||
task: "Manage task queue"
|
||||
cancel: "Cancel task"
|
||||
watch: "Watch chats (UserBot)"
|
||||
@@ -296,20 +297,26 @@ bot:
|
||||
info_urls_select_storage: "Found {{.Count}} links, please select storage"
|
||||
info_downloading: "Downloading via yt-dlp..."
|
||||
error_download_failed: "yt-dlp download failed: {{.Error}}"
|
||||
import:
|
||||
usage: "Usage: /import <storage_name> <dir_path> [target_chat_id] [filter]\n\nExamples:\n/import local1 /downloads\n/import MyAlist /media/photos -1001234567890\n/import MyLocal /backup \".*[.]mp4$\""
|
||||
transfer:
|
||||
usage: |
|
||||
Usage: /transfer <source_storage>:/<source_path> <target_storage>:/<target_path> [filter]
|
||||
Examples:
|
||||
/transfer local1:/downloads tg1:/backup
|
||||
/transfer alist1:/media/photos local1:/photos
|
||||
/transfer webdav1:/files tg1:/archive ".*\.mp4$"
|
||||
error_invalid_source: "Invalid source path format, should be: storage_name:/path"
|
||||
error_invalid_target: "Invalid target path format, should be: storage_name:/path"
|
||||
error_storage_not_found: "Storage '{{.StorageName}}' not found or access denied: {{.Error}}"
|
||||
error_storage_not_listable: "Storage '{{.StorageName}}' does not support listing files"
|
||||
error_storage_not_readable: "Storage '{{.StorageName}}' does not support reading files"
|
||||
error_no_telegram_storage: "No Telegram storage found: {{.Error}}"
|
||||
error_target_not_found: "Target storage '{{.StorageName}}' not found or access denied: {{.Error}}"
|
||||
info_fetching_files: "Fetching file list..."
|
||||
error_list_files_failed: "Failed to list files: {{.Error}}"
|
||||
error_invalid_regex: "Invalid regular expression: {{.Error}}"
|
||||
error_no_files_to_import: "No files to import in directory"
|
||||
error_invalid_chat_id: "Invalid Chat ID: {{.Error}}"
|
||||
error_no_target_chat_id: "No target channel ID specified and Telegram storage has no default chat_id configured"
|
||||
error_no_files_to_transfer: "No files to transfer in directory"
|
||||
error_add_task_failed: "Failed to add task: {{.Error}}"
|
||||
info_task_added: "Added {{.Count}} files to import queue\nTotal size: {{.SizeMB}} MB\nTask ID: {{.TaskID}}"
|
||||
info_task_added: "Added {{.Count}} files to transfer queue\nTotal size: {{.SizeMB}} MB\nTask ID: {{.TaskID}}"
|
||||
start_stats: "Total files: {{.Count}}\nTotal size: {{.SizeMB}} MB"
|
||||
cancel:
|
||||
usage: "Usage: /cancel <task_id>"
|
||||
error_cancel_failed: "Failed to cancel task: {{.Error}}"
|
||||
@@ -358,20 +365,20 @@ bot:
|
||||
ytdlp_done: "yt-dlp download completed and transferred ({{.Count}} files)\n"
|
||||
downloaded_prefix: "\nDownloaded: "
|
||||
current_speed_prefix: "\nCurrent speed: "
|
||||
import_start_prefix: "Importing: "
|
||||
import_progress_prefix: "Import progress: "
|
||||
import_uploaded_prefix: "\nUploaded: "
|
||||
import_speed_prefix: "\nSpeed: "
|
||||
import_remaining_time_prefix: "\nRemaining time: "
|
||||
import_processing_prefix: "\nProcessing:\n"
|
||||
import_processing_more: "...and {{.Count}} more files\n"
|
||||
import_failed_prefix: "Import failed\n"
|
||||
import_success_prefix: "Import completed\n"
|
||||
import_total_files_prefix: "\nTotal files: "
|
||||
import_total_size_prefix: "\nTotal size: "
|
||||
import_elapsed_time_prefix: "\nElapsed time: "
|
||||
import_avg_speed_prefix: "\nAverage speed: "
|
||||
import_failed_files_prefix: "\nFailed files: "
|
||||
transfer_start_prefix: "Importing: "
|
||||
transfer_progress_prefix: "Import progress: "
|
||||
transfer_uploaded_prefix: "\nUploaded: "
|
||||
transfer_speed_prefix: "\nSpeed: "
|
||||
transfer_remaining_time_prefix: "\nRemaining time: "
|
||||
transfer_processing_prefix: "\nProcessing:\n"
|
||||
transfer_processing_more: "...and {{.Count}} more files\n"
|
||||
transfer_failed_prefix: "Import failed\n"
|
||||
transfer_success_prefix: "Import completed\n"
|
||||
transfer_total_files_prefix: "\nTotal files: "
|
||||
transfer_total_size_prefix: "\nTotal size: "
|
||||
transfer_elapsed_time_prefix: "\nElapsed time: "
|
||||
transfer_avg_speed_prefix: "\nAverage speed: "
|
||||
transfer_failed_files_prefix: "\nFailed files: "
|
||||
syncpeers:
|
||||
start: "Starting to sync peers..."
|
||||
done: "Peer sync completed, total {{.Count}} chats synced"
|
||||
|
||||
@@ -55,6 +55,7 @@ bot:
|
||||
aria2dl: "使用 Aria2 下载给定链接的文件"
|
||||
ytdlp: "使用 yt-dlp 下载视频/音频"
|
||||
import: "从存储端导入文件到 Telegram"
|
||||
transfer: "在存储端之间传输文件"
|
||||
task: "管理任务队列"
|
||||
cancel: "取消任务"
|
||||
watch: "监听聊天(UserBot)"
|
||||
@@ -297,25 +298,25 @@ bot:
|
||||
info_urls_select_storage: "共 {{.Count}} 个链接, 请选择存储位置"
|
||||
info_downloading: "正在通过 yt-dlp 下载..."
|
||||
error_download_failed: "yt-dlp 下载失败: {{.Error}}"
|
||||
import:
|
||||
transfer:
|
||||
usage: |
|
||||
用法: /import <storage_name> <dir_path> [target_chat_id] [filter]
|
||||
用法: /transfer <source_storage>:/<source_path> <target_storage>:/<target_path> [filter]
|
||||
示例:
|
||||
/import 本机1 /downloads
|
||||
/import MyAlist /media/photos -1001234567890
|
||||
/import MyLocal /backup ".*\.mp4$"
|
||||
/transfer local1:/downloads tg1:/backup
|
||||
/transfer alist1:/media/photos local1:/photos
|
||||
/transfer webdav1:/files tg1:/archive ".*\.mp4$"
|
||||
error_invalid_source: "源路径格式无效,应为: storage_name:/path"
|
||||
error_invalid_target: "目标路径格式无效,应为: storage_name:/path"
|
||||
error_storage_not_found: "存储端 '{{.StorageName}}' 不存在或您无权访问: {{.Error}}"
|
||||
error_storage_not_listable: "存储端 '{{.StorageName}}' 不支持列举文件功能"
|
||||
error_storage_not_readable: "存储端 '{{.StorageName}}' 不支持读取文件功能"
|
||||
error_no_telegram_storage: "未找到可用的 Telegram 存储: {{.Error}}"
|
||||
error_target_not_found: "目标存储端 '{{.StorageName}}' 不存在或您无权访问: {{.Error}}"
|
||||
info_fetching_files: "正在获取文件列表..."
|
||||
error_list_files_failed: "获取文件列表失败: {{.Error}}"
|
||||
error_invalid_regex: "正则表达式无效: {{.Error}}"
|
||||
error_no_files_to_import: "目录中没有可导入的文件"
|
||||
error_invalid_chat_id: "无效的 Chat ID: {{.Error}}"
|
||||
error_no_target_chat_id: "未指定目标频道 ID,且 Telegram 存储未配置默认 chat_id"
|
||||
error_no_files_to_transfer: "目录中没有可传输的文件"
|
||||
error_add_task_failed: "添加任务失败: {{.Error}}"
|
||||
info_task_added: "已添加 {{.Count}} 个文件到导入队列\n总大小: {{.SizeMB}} MB\n任务 ID: {{.TaskID}}"
|
||||
info_task_added: "已添加 {{.Count}} 个文件到传输队列\n总大小: {{.SizeMB}} MB\n任务 ID: {{.TaskID}}"
|
||||
start_stats: "总文件数: {{.Count}}\n总大小: {{.SizeMB}} MB"
|
||||
cancel:
|
||||
usage: "用法: /cancel <task_id>"
|
||||
@@ -365,20 +366,20 @@ bot:
|
||||
ytdlp_done: "yt-dlp 下载完成并已转存 ({{.Count}} 个文件)\n"
|
||||
downloaded_prefix: "\n已下载: "
|
||||
current_speed_prefix: "\n当前速度: "
|
||||
import_start_prefix: "正在导入: "
|
||||
import_progress_prefix: "导入进度: "
|
||||
import_uploaded_prefix: "\n已上传: "
|
||||
import_speed_prefix: "\n速度: "
|
||||
import_remaining_time_prefix: "\n剩余时间: "
|
||||
import_processing_prefix: "\n正在处理:\n"
|
||||
import_processing_more: "...和其他 {{.Count}} 个文件\n"
|
||||
import_failed_prefix: "导入失败\n"
|
||||
import_success_prefix: "导入完成\n"
|
||||
import_total_files_prefix: "\n总文件数: "
|
||||
import_total_size_prefix: "\n总大小: "
|
||||
import_elapsed_time_prefix: "\n耗时: "
|
||||
import_avg_speed_prefix: "\n平均速度: "
|
||||
import_failed_files_prefix: "\n失败文件数: "
|
||||
transfer_start_prefix: "正在导入: "
|
||||
transfer_progress_prefix: "导入进度: "
|
||||
transfer_uploaded_prefix: "\n已上传: "
|
||||
transfer_speed_prefix: "\n速度: "
|
||||
transfer_remaining_time_prefix: "\n剩余时间: "
|
||||
transfer_processing_prefix: "\n正在处理:\n"
|
||||
transfer_processing_more: "...和其他 {{.Count}} 个文件\n"
|
||||
transfer_failed_prefix: "导入失败\n"
|
||||
transfer_success_prefix: "导入完成\n"
|
||||
transfer_total_files_prefix: "\n总文件数: "
|
||||
transfer_total_size_prefix: "\n总大小: "
|
||||
transfer_elapsed_time_prefix: "\n耗时: "
|
||||
transfer_avg_speed_prefix: "\n平均速度: "
|
||||
transfer_failed_files_prefix: "\n失败文件数: "
|
||||
syncpeers:
|
||||
start: "正在同步对话列表..."
|
||||
success: "对话列表同步完成, 共同步 {{.Count}} 个对话"
|
||||
|
||||
Reference in New Issue
Block a user