fix: add UserID to link message and enforce default storage setting in silent handler
This commit is contained in:
@@ -102,6 +102,7 @@ func handleLinkMessage(ctx *ext.Context, update *ext.Update) error {
|
||||
Status: types.Pending,
|
||||
File: file,
|
||||
StorageName: user.DefaultStorage,
|
||||
UserID: user.ChatID,
|
||||
FileChatID: linkChat.GetID(),
|
||||
FileMessageID: messageID,
|
||||
ReplyMessageID: replied.ID,
|
||||
|
||||
@@ -88,6 +88,10 @@ func silent(ctx *ext.Context, update *ext.Update) error {
|
||||
logger.L.Errorf("获取用户失败: %s", err)
|
||||
return dispatcher.EndGroups
|
||||
}
|
||||
if !user.Silent && user.DefaultStorage == "" {
|
||||
ctx.Reply(update, ext.ReplyTextString("请先使用 /storage 设置默认存储位置"), nil)
|
||||
return dispatcher.EndGroups
|
||||
}
|
||||
user.Silent = !user.Silent
|
||||
if err := dao.UpdateUser(user); err != nil {
|
||||
logger.L.Errorf("更新用户失败: %s", err)
|
||||
|
||||
Reference in New Issue
Block a user