From 6e26d4ace6ceaf548add89eac030a7349259f0f6 Mon Sep 17 00:00:00 2001 From: Matthieu Grieger Date: Tue, 30 Dec 2014 13:32:48 -0800 Subject: [PATCH] Fails more gracefully if audio download fails --- commands.go | 3 ++- strings.go | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/commands.go b/commands.go index 80c84f3..292a613 100644 --- a/commands.go +++ b/commands.go @@ -45,7 +45,8 @@ func parseCommand(user *gumble.User, username, command string) { if err := dj.currentSong.Download(); err == nil { dj.currentSong.Play() } else { - panic(err) + user.Send(AUDIO_FAIL_MSG) + dj.currentSong.Delete() } } } else { diff --git a/strings.go b/strings.go index ac34301..8d8bf4a 100644 --- a/strings.go +++ b/strings.go @@ -38,6 +38,9 @@ const ADMIN_SONG_SKIP_MSG = "An admin has decided to skip the current song." // Message shown to user when the kill command errors. const KILL_ERROR_MSG = "An error occurred while attempting to kill the bot." +// Message shown to users when the audio for a video could not be downloaded. +const AUDIO_FAIL_MSG = "The audio download for this video failed. YouTube has likely not generated the audio files for this video yet." + // Message shown to a channel when a new song starts playing. const NOW_PLAYING_HTML = `