From 06bef0a71e3d5fbbd45194a6850575abeaf16ac5 Mon Sep 17 00:00:00 2001 From: 70sh1 <54360854+70sh1@users.noreply.github.com> Date: Mon, 12 Feb 2024 08:53:41 +0300 Subject: [PATCH] Improve Args payload parsing This us achieved by using strings.Fields instead of strings.Split This results in a cleaner output when parsing messages like "/tags a lot of spaces" Output before: `[]string{"a", "", "", "", "", "", "", "", "", "", "lot", "", "", "", "", "", "", "", "", "of", "", "", "", "", "", "", "", "spaces"}` Output after the change: `[]string{"a", "lot", "of", "spaces"}` --- context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/context.go b/context.go index 3306c8f..98ede2e 100644 --- a/context.go +++ b/context.go @@ -355,7 +355,7 @@ func (c *nativeContext) Args() []string { case c.u.Message != nil: payload := strings.Trim(c.u.Message.Payload, " ") if payload != "" { - return strings.Split(payload, " ") + return strings.Fields(payload) } case c.u.Callback != nil: return strings.Split(c.u.Callback.Data, "|")