disconnect after failed attempt
Marco Andronaco andronacomarco@gmail.com
Fri, 22 Nov 2024 17:09:56 +0100
4 files changed,
8 insertions(+),
17 deletions(-)
M
src/music/commands.go
→
src/music/commands.go
@@ -39,15 +39,18 @@ logger.Errorf("could not join voice channel: %v", err)
return gl.MsgError } + // Get the queue for the guild + q := GetOrCreateQueue(voice) + // Get the video information video, err := getVideo(args) if err != nil { logger.Errorf("could not get video: %v", err) + if q.nowPlaying == nil { + voice.Disconnect() + } return gl.MsgError } - - // Get the queue for the guild - q := GetOrCreateQueue(voice) // Add video to the queue q.AddVideo(video)
M
src/music/video.go
→
src/music/video.go
@@ -51,7 +51,7 @@
func getFromYT(videoID string) (video *youtube.Video, err error) { url := "https://youtu.be/" + videoID - const maxRetries = 3 + const maxRetries = 5 const maxBytesToCheck = 1024 var duration time.Duration
M
src/mylog/log.go
→
src/mylog/log.go
@@ -84,30 +84,18 @@ l.fatalLogger.Fatalf(format, v...)
} func (l Logger) Error(v ...any) { - if l.level < ERROR { - return - } l.errorLogger.Println(v...) } func (l Logger) Errorf(format string, v ...any) { - if l.level < ERROR { - return - } l.errorLogger.Printf(format, v...) } func (l Logger) Warn(v ...any) { - if l.level < WARN { - return - } l.warnLogger.Println(v...) } func (l Logger) Warnf(format string, v ...any) { - if l.level < WARN { - return - } l.warnLogger.Printf(format, v...) }