mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-05-11 19:09:39 +08:00
feat: init commit
This commit is contained in:
41
types/types.go
Normal file
41
types/types.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package types
|
||||
|
||||
import "context"
|
||||
|
||||
type TaskStatus string
|
||||
|
||||
var (
|
||||
Pending TaskStatus = "pending"
|
||||
Succeeded TaskStatus = "succeeded"
|
||||
Failed TaskStatus = "failed"
|
||||
Canceled TaskStatus = "canceled"
|
||||
)
|
||||
|
||||
type StorageType string
|
||||
|
||||
var (
|
||||
StorageAll StorageType = "all"
|
||||
Local StorageType = "local"
|
||||
Alist StorageType = "alist"
|
||||
)
|
||||
|
||||
var StorageTypes = []StorageType{Local, Alist, StorageAll}
|
||||
|
||||
type Task struct {
|
||||
Ctx context.Context
|
||||
FileID string
|
||||
Error error
|
||||
Status TaskStatus
|
||||
FilePath string // telegram File object's FilePath
|
||||
FileName string
|
||||
Storage StorageType
|
||||
StoragePath string
|
||||
|
||||
// For track progress
|
||||
ChatID int64
|
||||
ReplyMessageID int
|
||||
}
|
||||
|
||||
func (t *Task) String() string {
|
||||
return t.FileName
|
||||
}
|
||||
Reference in New Issue
Block a user