Fix https://github.com/matthieugrieger/mumbledj/issues/32: \!reset crash when no audio is playing
This commit is contained in:
parent
23ef674313
commit
0275ab2fb3
|
@ -4,6 +4,7 @@ MumbleDJ Changelog
|
||||||
### February 2, 2015 -- `v2.3.4, v2.3.5`
|
### February 2, 2015 -- `v2.3.4, v2.3.5`
|
||||||
* Added panic on audio play fail for debugging purposes.
|
* Added panic on audio play fail for debugging purposes.
|
||||||
* Fixed '!' being recognized as '!skipplaylist'.
|
* Fixed '!' being recognized as '!skipplaylist'.
|
||||||
|
* Fixed !reset crash when there is no audio playing.
|
||||||
|
|
||||||
### January 30, 2015 -- `v2.3.3`
|
### January 30, 2015 -- `v2.3.3`
|
||||||
* Fixed private messages crashing the bot when the target user switches channels or disconnects.
|
* Fixed private messages crashing the bot when the target user switches channels or disconnects.
|
||||||
|
|
|
@ -304,12 +304,13 @@ func reload(user *gumble.User) {
|
||||||
// remaining songs in the ~/.mumbledj/songs directory.
|
// remaining songs in the ~/.mumbledj/songs directory.
|
||||||
func reset(username string) {
|
func reset(username string) {
|
||||||
dj.queue.queue = dj.queue.queue[:0]
|
dj.queue.queue = dj.queue.queue[:0]
|
||||||
if err := dj.audioStream.Stop(); err == nil {
|
if dj.audioStream.IsPlaying() {
|
||||||
if err := deleteSongs(); err == nil {
|
if err := dj.audioStream.Stop(); err != nil {
|
||||||
dj.client.Self().Channel().Send(fmt.Sprintf(QUEUE_RESET_HTML, username), false)
|
|
||||||
} else {
|
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if err := deleteSongs(); err == nil {
|
||||||
|
dj.client.Self().Channel().Send(fmt.Sprintf(QUEUE_RESET_HTML, username), false)
|
||||||
} else {
|
} else {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue