From f585e6ba06d2720704bfdcf08fad08eb6fc9f0e9 Mon Sep 17 00:00:00 2001 From: Aine Date: Fri, 23 Sep 2022 18:16:39 +0300 Subject: [PATCH] fix !pm send parsing --- utils/command.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/command.go b/utils/command.go index 91e7a04..4fe48bf 100644 --- a/utils/command.go +++ b/utils/command.go @@ -10,12 +10,12 @@ var ErrInvalidArgs = fmt.Errorf("invalid arguments") // ParseSend parses "!pm send" command, returns to, subject, body, err func ParseSend(commandSlice []string) (string, string, string, error) { - if len(commandSlice) < 3 { + message := strings.Join(commandSlice, " ") + lines := strings.Split(message, "\n") + if len(lines) < 3 { return "", "", "", ErrInvalidArgs } - message := strings.Join(commandSlice, " ") - lines := strings.Split(message, "\n") commandSlice = strings.Split(lines[0], " ") to := commandSlice[1] subject := lines[1]