mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-05-28 11:42:11 +08:00
refactor: complete core features
This commit is contained in:
21
types/model.go
Normal file
21
types/model.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type ReceivedFile struct {
|
||||
gorm.Model
|
||||
Processing bool
|
||||
ChatID int64
|
||||
MessageID int
|
||||
ReplyMessageID int
|
||||
FileName string
|
||||
}
|
||||
|
||||
type User struct {
|
||||
gorm.Model
|
||||
UserID int64 `gorm:"uniqueIndex"`
|
||||
Silent bool
|
||||
DefaultStorage string
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package types
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/gotd/td/tg"
|
||||
)
|
||||
@@ -30,7 +31,7 @@ type Task struct {
|
||||
Ctx context.Context
|
||||
Error error
|
||||
Status TaskStatus
|
||||
FileName string
|
||||
File *File
|
||||
Storage StorageType
|
||||
StoragePath string
|
||||
|
||||
@@ -40,7 +41,11 @@ type Task struct {
|
||||
}
|
||||
|
||||
func (t Task) String() string {
|
||||
return t.FileName
|
||||
return fmt.Sprintf("[%d:%d]:%s", t.ChatID, t.MessageID, t.File.FileName)
|
||||
}
|
||||
|
||||
func (t Task) FileName() string {
|
||||
return t.File.FileName
|
||||
}
|
||||
|
||||
type File struct {
|
||||
|
||||
Reference in New Issue
Block a user