mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-05-12 06:09:40 +08:00
feat: implement task cancellation feature and update task handling
This commit is contained in:
@@ -36,6 +36,7 @@ var StorageTypeDisplay = map[StorageType]string{
|
||||
|
||||
type Task struct {
|
||||
Ctx context.Context
|
||||
Cancel context.CancelFunc
|
||||
Error error
|
||||
Status TaskStatus
|
||||
File *File
|
||||
@@ -52,6 +53,10 @@ type Task struct {
|
||||
UserID int64
|
||||
}
|
||||
|
||||
func (t Task) Key() string {
|
||||
return fmt.Sprintf("%d:%d", t.FileChatID, t.FileMessageID)
|
||||
}
|
||||
|
||||
func (t Task) String() string {
|
||||
return fmt.Sprintf("[%d:%d]:%s", t.FileChatID, t.FileMessageID, t.File.FileName)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user