Fails more gracefully if audio download fails

This commit is contained in:
Matthieu Grieger 2014-12-30 13:32:48 -08:00
parent 68a4052809
commit 6e26d4ace6
2 changed files with 5 additions and 1 deletions

View file

@ -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 {

View file

@ -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 = `
<table>