feat: add directory management functionality and update handlers to utilize default directory

This commit is contained in:
krau
2025-11-16 21:09:55 +08:00
parent fe47ee3b51
commit 3f40acff55
12 changed files with 148 additions and 57 deletions

View File

@@ -4,12 +4,14 @@ package handlers
import (
"errors"
"path"
"strings"
"github.com/celestix/gotgproto/dispatcher"
"github.com/celestix/gotgproto/ext"
"github.com/charmbracelet/log"
"github.com/gotd/td/tg"
"github.com/krau/SaveAny-Bot/client/bot/handlers/utils/dirutil"
"github.com/krau/SaveAny-Bot/client/bot/handlers/utils/msgelem"
"github.com/krau/SaveAny-Bot/client/bot/handlers/utils/shortcut"
"github.com/krau/SaveAny-Bot/common/utils/fsutil"
@@ -117,5 +119,8 @@ func handleSilentSaveText(ctx *ext.Context, u *ext.Update) error {
if len(item.Resources) > 1 {
dirPath = fsutil.NormalizePathname(item.Title)
}
if p := dirutil.PathFromContext(ctx); p != "" {
dirPath = path.Join(p, dirPath)
}
return shortcut.CreateAndAddParsedTaskWithEdit(ctx, stor, dirPath, item, msg.ID, userID)
}