From d857e5db630659fa6f4f946ca34b36e00b81bb1c Mon Sep 17 00:00:00 2001 From: cdle <798731886@qq.com> Date: Thu, 30 Sep 2021 17:39:32 +0800 Subject: [PATCH] update --- core/function.go | 7 +++++-- core/otto.go | 12 +++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/core/function.go b/core/function.go index aa47db5..55bd7bd 100644 --- a/core/function.go +++ b/core/function.go @@ -50,6 +50,9 @@ func AddCommand(prefix string, cmds []Function) { cmds[j].Rules[i] = strings.Replace(cmds[j].Rules[i], "raw ", "", -1) continue } + if strings.Contains(cmds[j].Rules[i], "$") { + continue + } if prefix != "" { cmds[j].Rules[i] = prefix + `\s+` + cmds[j].Rules[i] } @@ -94,8 +97,8 @@ func handleMessage(sender Sender) { } if matched { if function.Admin && !sender.IsAdmin() { - sender.Delete() - sender.Disappear() + sender.Delete() + sender.Disappear() sender.Reply("没有权限操作") sender.Finish() return diff --git a/core/otto.go b/core/otto.go index 259a301..c4921f5 100644 --- a/core/otto.go +++ b/core/otto.go @@ -169,11 +169,13 @@ func init() { return result } logs.Warn("回复:%s添加成功", jr) - functions = append(functions, Function{ - Handle: handler, - Rules: rules, - Cron: cron, - Admin: admin, + AddCommand("", []Function{ + { + Handle: handler, + Rules: rules, + Cron: cron, + Admin: admin, + }, }) } }