This commit is contained in:
cdle
2021-09-17 21:50:20 +08:00
parent d793920ad6
commit 29566c23c9
2 changed files with 7 additions and 4 deletions
+7 -2
View File
@@ -5,6 +5,7 @@ import (
"regexp" "regexp"
"strings" "strings"
"github.com/beego/beego/v2/adapter/logs"
"github.com/cdle/sillyGirl/im" "github.com/cdle/sillyGirl/im"
cron "github.com/robfig/cron/v3" cron "github.com/robfig/cron/v3"
) )
@@ -61,9 +62,13 @@ func AddCommand(prefix string, cmds []Function) {
} }
functions = append(functions, cmds[j]) functions = append(functions, cmds[j])
if cmds[j].Cron != "" { if cmds[j].Cron != "" {
c.AddFunc(cmds[j].Cron, func() { if _, err := c.AddFunc(cmds[j].Cron, func() {
cmds[j].Handle(&im.Faker{}) cmds[j].Handle(&im.Faker{})
}) }); err != nil {
logs.Warn("任务%v添加失败%v", cmds[j].Rules[0], err)
} else {
logs.Warn("任务%v添加成功", cmds[j].Rules[0])
}
} }
} }
} }
-2
View File
@@ -185,9 +185,7 @@ func (sender *Sender) Reply(msgs ...interface{}) error {
MSG := bot.GetMessage(id) MSG := bot.GetMessage(id)
bot.Client.RecallGroupMessage(m.GroupCode, MSG["message-id"].(int32), MSG["internal-id"].(int32)) bot.Client.RecallGroupMessage(m.GroupCode, MSG["message-id"].(int32), MSG["internal-id"].(int32))
}() }()
} }
} }
return nil return nil
} }