Fix https://github.com/matthieugrieger/mumbledj/issues/32: Newlines messing up \!add commands
This commit is contained in:
parent
0275ab2fb3
commit
6ba9f94e71
|
@ -5,6 +5,7 @@ MumbleDJ Changelog
|
||||||
* 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.
|
* Fixed !reset crash when there is no audio playing.
|
||||||
|
* Fixed newlines after YouTube URL messing up !add commands.
|
||||||
|
|
||||||
### 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.
|
||||||
|
|
|
@ -22,7 +22,8 @@ import (
|
||||||
// it contains a command.
|
// it contains a command.
|
||||||
func parseCommand(user *gumble.User, username, command string) {
|
func parseCommand(user *gumble.User, username, command string) {
|
||||||
var com, argument string
|
var com, argument string
|
||||||
sanitizedCommand := sanitize.HTML(command)
|
newlineSplit := strings.Split(command, "<br />")
|
||||||
|
sanitizedCommand := sanitize.HTML(newlineSplit[0])
|
||||||
if strings.Contains(sanitizedCommand, " ") {
|
if strings.Contains(sanitizedCommand, " ") {
|
||||||
index := strings.Index(sanitizedCommand, " ")
|
index := strings.Index(sanitizedCommand, " ")
|
||||||
com, argument = sanitizedCommand[0:index], sanitizedCommand[(index+1):]
|
com, argument = sanitizedCommand[0:index], sanitizedCommand[(index+1):]
|
||||||
|
|
Reference in a new issue