Skip to content

Commit

Permalink
fix: handle yt-dlp errors
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTipo01 committed Sep 24, 2023
1 parent 7da64e1 commit 9691d8a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions events.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@ func videoDownload(c tele.Context) error {
filename, hit := checkAndDownload(url)

err := c.Reply(cache[filename], tele.Silent)
if err != nil {
lit.Error(err.Error())
}

if !hit {
save(cache[filename])
if err == nil && !hit {
go save(cache[filename])
}
} else {
// For twitter, we send the same url with only fx appended to it
Expand Down Expand Up @@ -48,7 +44,10 @@ func inlineQuery(c tele.Context) error {
filename, hit := checkAndDownload(text)

// Upload video to channel, so we can send it even in inline mode
_, _ = c.Bot().Send(tele.ChatID(cfg.Channel), cache[filename])
_, err := c.Bot().Send(tele.ChatID(cfg.Channel), cache[filename])
if err != nil {
return err
}

if !hit {
go save(cache[filename])
Expand Down

0 comments on commit 9691d8a

Please sign in to comment.