From f0ce2ac5d59e0ec452496a4e4660c0c6d44f2b12 Mon Sep 17 00:00:00 2001 From: cdle Date: Mon, 3 Jul 2023 14:20:36 +0800 Subject: [PATCH] x --- core/base_sender.go | 1 + core/function.go | 7 +++++-- core/plugin_impl.go | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/core/base_sender.go b/core/base_sender.go index d4e5b4c..5135108 100644 --- a/core/base_sender.go +++ b/core/base_sender.go @@ -499,6 +499,7 @@ func (s *BaseSender) Await(message common.Sender, callback func(common.Sender) i c = param } } + // c.UserID c.Message = message if len(c.Function.Rules) == 0 { c.Function.Rules = []string{`raw [\s\S]+`} diff --git a/core/function.go b/core/function.go index 024a0c6..ac954c8 100644 --- a/core/function.go +++ b/core/function.go @@ -506,14 +506,17 @@ func HandleMessage(sender common.Sender) { return true } } else { //群聊时 - if u != c.UserID { //群员发言 + if c.UserID != "" && u != c.UserID { //群员发言 if !c.ListenGroup { //未设置允许群员加入拒绝 return true } } } + } else { //私聊监听 + if c.UserID != "" && u != c.UserID { //其他用户 + return true + } } - for i := range c.Function.Rules { reg, err := regexp.Compile(c.Function.Rules[i]) if err != nil { diff --git a/core/plugin_impl.go b/core/plugin_impl.go index 2278569..566181f 100644 --- a/core/plugin_impl.go +++ b/core/plugin_impl.go @@ -402,10 +402,11 @@ func (sender *SenderJsIplm) Listen(ps ...interface{}) interface{} { } if persistent { options = append(options, "persistent") - } - if !persistent { + } else if len(carry.AllowPlatforms) == 0 { carry.AllowPlatforms = []string{sender.GetPlatform()} } + carry.UserID = sender.GetUserID() + carry.ChatID = sender.GetChatID() carry.UUID = sender.UUID options = append(options, carry) var newJsSender *SenderJsIplm