This commit is contained in:
cdle
2023-07-03 14:20:36 +08:00
parent c4a870ebaa
commit f0ce2ac5d5
3 changed files with 9 additions and 4 deletions
+1
View File
@@ -499,6 +499,7 @@ func (s *BaseSender) Await(message common.Sender, callback func(common.Sender) i
c = param c = param
} }
} }
// c.UserID
c.Message = message c.Message = message
if len(c.Function.Rules) == 0 { if len(c.Function.Rules) == 0 {
c.Function.Rules = []string{`raw [\s\S]+`} c.Function.Rules = []string{`raw [\s\S]+`}
+5 -2
View File
@@ -506,14 +506,17 @@ func HandleMessage(sender common.Sender) {
return true return true
} }
} else { //群聊时 } else { //群聊时
if u != c.UserID { //群员发言 if c.UserID != "" && u != c.UserID { //群员发言
if !c.ListenGroup { //未设置允许群员加入拒绝 if !c.ListenGroup { //未设置允许群员加入拒绝
return true return true
} }
} }
} }
} else { //私聊监听
if c.UserID != "" && u != c.UserID { //其他用户
return true
}
} }
for i := range c.Function.Rules { for i := range c.Function.Rules {
reg, err := regexp.Compile(c.Function.Rules[i]) reg, err := regexp.Compile(c.Function.Rules[i])
if err != nil { if err != nil {
+3 -2
View File
@@ -402,10 +402,11 @@ func (sender *SenderJsIplm) Listen(ps ...interface{}) interface{} {
} }
if persistent { if persistent {
options = append(options, "persistent") options = append(options, "persistent")
} } else if len(carry.AllowPlatforms) == 0 {
if !persistent {
carry.AllowPlatforms = []string{sender.GetPlatform()} carry.AllowPlatforms = []string{sender.GetPlatform()}
} }
carry.UserID = sender.GetUserID()
carry.ChatID = sender.GetChatID()
carry.UUID = sender.UUID carry.UUID = sender.UUID
options = append(options, carry) options = append(options, carry)
var newJsSender *SenderJsIplm var newJsSender *SenderJsIplm