Files
SaveAny-Bot/database/model.go
krau 133453b5d4 feat: implement watch for monitoring chat messages
- Added a new command handler for /watch that allows users to listen to messages from a specified chat and save them according to storage rules.
- Introduced filtering options for messages using regular expressions.
- Implemented functionality to start and stop watching chats, including error handling for invalid inputs and user settings.
- Created a new utility package for message element handling related to the watch feature.
- Updated the user model to manage watched chats, including methods to add, remove, and check if a chat is being watched.
2025-08-03 16:55:56 +08:00

40 lines
609 B
Go

package database
import (
"gorm.io/gorm"
)
type User struct {
gorm.Model
ChatID int64 `gorm:"uniqueIndex;not null"`
Silent bool
DefaultStorage string
Dirs []Dir
ApplyRule bool
Rules []Rule
WatchChats []WatchChat
}
type WatchChat struct {
gorm.Model
UserID uint // User's database ID (not chat ID)
ChatID int64
Filter string
}
type Dir struct {
gorm.Model
UserID uint
StorageName string
Path string
}
type Rule struct {
gorm.Model
UserID uint
Type string
Data string
StorageName string
DirPath string
}