From 3fde8557e73ac19af033d142570c2c45d603ddf2 Mon Sep 17 00:00:00 2001 From: shaoying Date: Tue, 30 Jul 2019 17:26:15 +0800 Subject: [PATCH] fix m.Form --- src/contexts/ctx/core.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/contexts/ctx/core.go b/src/contexts/ctx/core.go index 431441a9..14b0377d 100644 --- a/src/contexts/ctx/core.go +++ b/src/contexts/ctx/core.go @@ -2,6 +2,7 @@ package ctx import ( "errors" + "fmt" "io" "strings" "time" @@ -58,7 +59,7 @@ func (c *Context) Plugin(s *Context, args []string) string { m.Cmd(args) } for _, v := range m.Meta["result"] { - m.Show(v) + fmt.Printf(v) } return "" } @@ -329,7 +330,11 @@ func (m *Message) Sess(key string, arg ...interface{}) *Message { return nil } func (m *Message) Form(x *Command, arg []string) []string { - for _, form := range []map[string]int{m.Optionv("ctx.form").(map[string]int), x.Form} { + form, ok := m.Optionv("ctx.form").(map[string]int) + if !ok { + return arg + } + for _, form := range []map[string]int{form, x.Form} { if args := []string{}; form != nil { for i := 0; i < len(arg); i++ {