mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-06-26 01:31:29 +08:00
fix: update EffectiveUser cannot obtain the accurate user, use GetUserChat instead
This commit is contained in:
@@ -415,7 +415,7 @@ func AddToQueue(ctx *ext.Context, update *ext.Update) error {
|
||||
ReplyMessageID: record.ReplyMessageID,
|
||||
FileMessageID: record.MessageID,
|
||||
ReplyChatID: record.ReplyChatID,
|
||||
UserID: update.EffectiveUser().GetID(),
|
||||
UserID: update.GetUserChat().GetID(),
|
||||
})
|
||||
|
||||
entityBuilder := entity.Builder{}
|
||||
|
||||
@@ -49,6 +49,9 @@ func getSelectStorageMarkup(userChatID int64, fileChatID, fileMessageID int) (*t
|
||||
return nil, err
|
||||
}
|
||||
storages := storage.GetUserStorages(user.ChatID)
|
||||
if len(storages) == 0 {
|
||||
return nil, ErrNoStorages
|
||||
}
|
||||
|
||||
buttons := make([]tg.KeyboardButtonClass, 0)
|
||||
for _, storage := range storages {
|
||||
@@ -199,7 +202,7 @@ func ProvideSelectMessage(ctx *ext.Context, update *ext.Update, file *types.File
|
||||
} else {
|
||||
text, entities = entityBuilder.Complete()
|
||||
}
|
||||
markup, err := getSelectStorageMarkup(update.EffectiveUser().GetID(), int(chatID), fileMsgID)
|
||||
markup, err := getSelectStorageMarkup(update.GetUserChat().GetID(), int(chatID), fileMsgID)
|
||||
if errors.Is(err, ErrNoStorages) {
|
||||
logger.L.Errorf("Failed to get select storage markup: %s", err)
|
||||
ctx.EditMessage(update.EffectiveChat().GetID(), &tg.MessagesEditMessageRequest{
|
||||
|
||||
@@ -21,6 +21,7 @@ url = "socks5://127.0.0.1:7890"
|
||||
name = "本机1"
|
||||
# 存储类型, 目前可用: local , alist , webdav
|
||||
type = "local"
|
||||
# 启用存储
|
||||
enable = true
|
||||
base_path = "./downloads"
|
||||
|
||||
@@ -33,7 +34,7 @@ base_path = "./downloads/2"
|
||||
[[storages]]
|
||||
name = "MyAlist"
|
||||
type = "alist"
|
||||
enable = true
|
||||
enable = false
|
||||
base_path = '/'
|
||||
url = 'https://alist.com'
|
||||
username = 'admin'
|
||||
@@ -48,7 +49,7 @@ token_exp = 86400
|
||||
name = "MyWebdav"
|
||||
type = "webdav"
|
||||
base_path = '/path/telegram'
|
||||
enable = true
|
||||
enable = false
|
||||
url = 'https://example.com/dav'
|
||||
username = 'username'
|
||||
password = 'password'
|
||||
@@ -59,7 +60,7 @@ password = 'password'
|
||||
# user id
|
||||
id = 123456
|
||||
# 存储名称过滤列表
|
||||
storages = ["MyAlist", "本机1"]
|
||||
storages = ["本机1"]
|
||||
# 开启黑名单模式, 过滤列表中的存储将无法使用, 默认为白名单模式
|
||||
blacklist = false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user