Fails more gracefully if audio download fails
This commit is contained in:
parent
68a4052809
commit
6e26d4ace6
|
@ -45,7 +45,8 @@ func parseCommand(user *gumble.User, username, command string) {
|
||||||
if err := dj.currentSong.Download(); err == nil {
|
if err := dj.currentSong.Download(); err == nil {
|
||||||
dj.currentSong.Play()
|
dj.currentSong.Play()
|
||||||
} else {
|
} else {
|
||||||
panic(err)
|
user.Send(AUDIO_FAIL_MSG)
|
||||||
|
dj.currentSong.Delete()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -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.
|
// Message shown to user when the kill command errors.
|
||||||
const KILL_ERROR_MSG = "An error occurred while attempting to kill the bot."
|
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.
|
// Message shown to a channel when a new song starts playing.
|
||||||
const NOW_PLAYING_HTML = `
|
const NOW_PLAYING_HTML = `
|
||||||
<table>
|
<table>
|
||||||
|
|
Reference in a new issue