Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Commit

Permalink
Don't send error when stopped (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
rojvv authored Apr 23, 2022
1 parent 5d4472e commit 77ff6d4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion streamer/streamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package streamer
import (
"bot/processor"
"bot/ytdl"
"errors"
"fmt"
"net/url"

Expand All @@ -15,7 +16,10 @@ type Item struct {
Video *ytdl.Video
}

var now Item
var (
now Item
errSignalKilled = errors.New("signal: killed")
)

func Stream(b *gotgbot.Bot, input string, user *gotgbot.User) error {
var video *ytdl.Video
Expand All @@ -34,6 +38,9 @@ func Stream(b *gotgbot.Bot, input string, user *gotgbot.User) error {
if !ok {
break
}
if errSignalKilled.Error() == err.Error() {
continue
}
b.SendMessage(user.Id, fmt.Sprintf("Failed to process: %s", err.Error()), nil)
}
}()
Expand Down

0 comments on commit 77ff6d4

Please sign in to comment.