* refactor: a big refactor. wip * refactor: port handle file * refactor: place all handlers * fix: task info nil pointer * feat: enhance task progress tracking and context management * feat: cancel task * feat: stream mode * feat: silent mode * feat: dir cmd * refactor: remove unused old file * feat: rule cmd * feat: handle silent mode * feat: batch task * fix: batch task progress and temp file cleanup * refactor: update file creation and cleanup methods for better resource management * feat: add save command with silent mode handling * feat: message link * feat: update message prompts to include file count in storage selection * feat: slient save links * refactor: reduce dup code * feat: rule type * feat: chose dir * feat: refactor file handling and storage rules, improve error handling and logging * feat: rule mode * feat: telegraph pics * fix: tphpics nil pointer and inaccurate dirpath * feat: silent save telegraph * feat: add suffix to avoid file overwrite * feat: new storage telegram * chore: tidy go mod
37 lines
1021 B
Go
37 lines
1021 B
Go
package msgelem
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/gotd/td/telegram/message/styling"
|
|
"github.com/krau/SaveAny-Bot/database"
|
|
)
|
|
|
|
func BuildDirHelpStyling(dirs []database.Dir) []styling.StyledTextOption {
|
|
return []styling.StyledTextOption{
|
|
styling.Bold("使用方法: /dir <操作> <参数...>"),
|
|
styling.Plain("\n\n可用操作:\n"),
|
|
styling.Code("add"),
|
|
styling.Plain(" <存储名> <路径> - 添加路径\n"),
|
|
styling.Code("del"),
|
|
styling.Plain(" <路径ID> - 删除路径\n"),
|
|
styling.Plain("\n添加路径示例:\n"),
|
|
styling.Code("/dir add local1 path/to/dir"),
|
|
styling.Plain("\n\n删除路径示例:\n"),
|
|
styling.Code("/dir del 3"),
|
|
styling.Plain("\n\n当前已添加的路径:\n"),
|
|
styling.Blockquote(func() string {
|
|
var sb strings.Builder
|
|
for _, dir := range dirs {
|
|
sb.WriteString(fmt.Sprintf("%d: ", dir.ID))
|
|
sb.WriteString(dir.StorageName)
|
|
sb.WriteString(" - ")
|
|
sb.WriteString(dir.Path)
|
|
sb.WriteString("\n")
|
|
}
|
|
return sb.String()
|
|
}(), true),
|
|
}
|
|
}
|