From 2857b57c8ec791d27aea035eed89d3ff1442539a Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 24 May 2020 19:03:57 +0300 Subject: [PATCH] Use strings.Fields instead of manually removing spaces --- commands.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/commands.go b/commands.go index 1f90136..cc7b09b 100644 --- a/commands.go +++ b/commands.go @@ -77,15 +77,7 @@ 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] + args := strings.Fields(message) ce := &CommandEvent{ Bot: handler.bridge.Bot, Bridge: handler.bridge,