mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-12-13 09:03:10 +01:00
Use strings.Fields instead of manually removing spaces
This commit is contained in:
parent
d625ad0066
commit
2857b57c8e
1 changed files with 1 additions and 9 deletions
10
commands.go
10
commands.go
|
@ -77,15 +77,7 @@ func (ce *CommandEvent) Reply(msg string, args ...interface{}) {
|
||||||
|
|
||||||
// Handle handles messages to the bridge
|
// Handle handles messages to the bridge
|
||||||
func (handler *CommandHandler) Handle(roomID id.RoomID, user *User, message string) {
|
func (handler *CommandHandler) Handle(roomID id.RoomID, user *User, message string) {
|
||||||
args := strings.Split(message, " ")
|
args := strings.Fields(message)
|
||||||
ptr := 0
|
|
||||||
for i := 0; i < len(args); i++ {
|
|
||||||
if args[i] != "" {
|
|
||||||
args[ptr] = args[i]
|
|
||||||
ptr++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
args = args[:ptr]
|
|
||||||
ce := &CommandEvent{
|
ce := &CommandEvent{
|
||||||
Bot: handler.bridge.Bot,
|
Bot: handler.bridge.Bot,
|
||||||
Bridge: handler.bridge,
|
Bridge: handler.bridge,
|
||||||
|
|
Loading…
Reference in a new issue