context: args used to return [""] of length 1

This commit is contained in:
Ian P Badtrousers 2021-07-05 14:25:24 +03:00
parent 83bd8dd89d
commit 7e3a68249a

View File

@ -261,7 +261,11 @@ func (c *nativeContext) Data() string {
func (c *nativeContext) Args() []string {
if c.message != nil {
return strings.Split(c.message.Payload, " ")
message := strings.Trim(c.message.Payload, " ")
if message == "" {
return nil
}
return strings.Split(message, " ")
}
if c.callback != nil {
return strings.Split(c.callback.Data, "|")