x
This commit is contained in:
@@ -238,6 +238,7 @@ func init() {
|
||||
}()
|
||||
|
||||
for {
|
||||
//{"self_id":"17745270","status":{"online":true,"good":false},"time":1686281911,"post_type":"meta_event","meta_event_type":"heartbeat","interval":3000}
|
||||
_, data, err := ws.ReadMessage()
|
||||
if err != nil {
|
||||
|
||||
|
||||
+6
-7
@@ -172,7 +172,8 @@ func (f *Factory) Init(botplt, botid string) {
|
||||
f.demo = &CustomSender{
|
||||
f: f,
|
||||
}
|
||||
if _, ok := Bots[[2]string{botplt, botid}]; ok {
|
||||
if v, ok := Bots[[2]string{botplt, botid}]; ok {
|
||||
v.Destroy()
|
||||
console.Warn("%s机器人%s因冲突销毁!", botplt, botid)
|
||||
}
|
||||
Bots[[2]string{botplt, botid}] = f
|
||||
@@ -188,12 +189,9 @@ func (f *Factory) Init(botplt, botid string) {
|
||||
script: plugins.GetString(f.uuid),
|
||||
}
|
||||
str := su.GetValue("message")
|
||||
if str == "" {
|
||||
return
|
||||
}
|
||||
ss := regexp.MustCompile(`\S+`).FindAllString(str, -1)
|
||||
if len(ss) == 0 {
|
||||
return
|
||||
ss = []string{f.botplt}
|
||||
}
|
||||
if ss[0] != f.botplt {
|
||||
ss = []string{f.botplt}
|
||||
@@ -208,11 +206,12 @@ func (f *Factory) Init(botplt, botid string) {
|
||||
}()
|
||||
}
|
||||
|
||||
func (f *Factory) Fail() {
|
||||
func (f *Factory) Fail() int {
|
||||
f.errorTimes++
|
||||
if f.errorTimes > 5 {
|
||||
f.Destroy()
|
||||
go f.Destroy()
|
||||
}
|
||||
return f.errorTimes
|
||||
}
|
||||
|
||||
func (f *Factory) Success() {
|
||||
|
||||
@@ -230,6 +230,7 @@ func init() {
|
||||
if ncg.In {
|
||||
if ncg.Enable {
|
||||
AddListenOnGroup(ncg.ID, fmt.Sprintf("已为采集群(%s)开启监听模式", ncg.ID))
|
||||
AddNoReplyGroups(ncg.ID, fmt.Sprintf("已为采集群(%s)开启禁言模式", ncg.ID))
|
||||
} else {
|
||||
RemListenOnGroup(ncg.ID, fmt.Sprintf("已为采集群(%s)关闭监听模式", ncg.ID))
|
||||
}
|
||||
@@ -248,6 +249,7 @@ func init() {
|
||||
tmp = append(tmp, ncg)
|
||||
if ncg.In && ncg.Enable {
|
||||
AddListenOnGroup(ncg.ID, fmt.Sprintf("已为采集群(%s)开启监听模式", ncg.ID))
|
||||
AddNoReplyGroups(ncg.ID, fmt.Sprintf("已为采集群(%s)开启禁言模式", ncg.ID))
|
||||
}
|
||||
} else {
|
||||
return nil
|
||||
@@ -271,6 +273,7 @@ func setCgs() {
|
||||
}
|
||||
if cg.In {
|
||||
AddListenOnGroup(cg.ID, fmt.Sprintf("已为采集群(%s)开启监听模式", cg.ID))
|
||||
AddNoReplyGroups(cg.ID, fmt.Sprintf("已为采集群(%s)开启禁言模式", cg.ID))
|
||||
}
|
||||
cgs = append(cgs, cg)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user