Ignore multiple spaces in commands

This commit is contained in:
Tulir Asokan 2020-05-24 17:03:50 +03:00
parent 9dfd9c88b2
commit bb883e1262

View file

@ -78,6 +78,14 @@ func (ce *CommandEvent) Reply(msg string, args ...interface{}) {
// Handle handles messages to the bridge
func (handler *CommandHandler) Handle(roomID id.RoomID, user *User, message string) {
args := strings.Split(message, " ")
ptr := 0
for i := 0; i < len(args); i++ {
if args[i] != "" {
args[ptr] = args[i]
ptr++
}
}
args = args[:ptr]
ce := &CommandEvent{
Bot: handler.bridge.Bot,
Bridge: handler.bridge,