File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,10 +47,11 @@ var (
4747)
4848
4949func init () {
50- en .OnMessage (chat .EnsureConfig , func (ctx * zero.Ctx ) bool {
50+ // 优先级设为 10,低于控制命令(SecondPriority=1),
51+ // 避免 /全局禁用、/启用 等管理命令被 AI 聊天抢先拦截
52+ aim := en .OnMessage (chat .EnsureConfig , func (ctx * zero.Ctx ) bool {
5153 stor , ok := ctx .State [zero .StateKeyPrefixKeep + "aichatcfg_stor__" ].(chat.Storage )
5254 if ! ok {
53- logrus .Warnln ("ERROR: cannot get stor" )
5455 return false
5556 }
5657 mp := ctx .State [control .StateKeySyncxState ].(* syncx.Map [string , any ])
@@ -70,7 +71,9 @@ func init() {
7071 ctx .Block ()
7172 }
7273 return true
73- }).SetBlock (false ).Handle (func (ctx * zero.Ctx ) {
74+ }).SetBlock (false )
75+ (* zero .Matcher )(aim ).SetPriority (10 )
76+ aim .Handle (func (ctx * zero.Ctx ) {
7477 gid := ctx .Event .GroupID
7578 if gid == 0 {
7679 gid = - ctx .Event .UserID
Original file line number Diff line number Diff line change @@ -16,8 +16,11 @@ func init() {
1616 Brief : "词典匹配回复, 仅@触发" ,
1717 PublicDataFolder : "Chat" ,
1818 })
19- engine .OnMessage (zero .OnlyToMe , canmatch ()).
20- SetBlock (false ).Handle (func (ctx * zero.Ctx ) {
19+ // 优先级设为 10,低于控制命令(SecondPriority=1),
20+ // 避免 /全局禁用、/启用 等管理命令被词库回复抢先拦截
21+ chatm := engine .OnMessage (zero .OnlyToMe , canmatch ()).SetBlock (false )
22+ (* zero .Matcher )(chatm ).SetPriority (10 )
23+ chatm .Handle (func (ctx * zero.Ctx ) {
2124 msg := ctx .ExtractPlainText ()
2225 r , err := kimoi .Chat (msg )
2326 if err == nil {
You can’t perform that action at this time.
0 commit comments