x
This commit is contained in:
+7
-1
@@ -59,11 +59,12 @@ type Factory struct {
|
||||
vm *goja.Runtime
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc
|
||||
destroid bool
|
||||
destroid bool ////已关闭
|
||||
errorTimes int
|
||||
Res *Response
|
||||
umod bool //类似订阅号一对一被动消息模式
|
||||
gmsgChan sync.Map
|
||||
sync.RWMutex
|
||||
}
|
||||
|
||||
type Bot [2]string //botplt botid
|
||||
@@ -267,6 +268,11 @@ func (f *Factory) IsAdapter(botid string) bool {
|
||||
func (f *Factory) Destroy() {
|
||||
BotsLocker.Lock()
|
||||
defer BotsLocker.Unlock()
|
||||
f.Lock()
|
||||
defer f.Unlock()
|
||||
if f.destroid {
|
||||
return
|
||||
}
|
||||
f.destroid = true
|
||||
f.cancel()
|
||||
close(f.msgChan)
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script src="/admin/umi.d1959e52.js"></script>
|
||||
<script src="/admin/umi.29bb0b44.js"></script>
|
||||
|
||||
</body></html>
|
||||
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+8
-6
@@ -432,12 +432,14 @@ func AddCommand(cmds []*common.Function) {
|
||||
}
|
||||
|
||||
func HandleMessage(sender common.Sender) {
|
||||
defer func() {
|
||||
err := recover()
|
||||
if err != nil {
|
||||
console.Error("HandleMessage error: %v", err)
|
||||
}
|
||||
}()
|
||||
if !debug {
|
||||
defer func() {
|
||||
err := recover()
|
||||
if err != nil {
|
||||
console.Error("HandleMessage error: %v", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
num := atomic.AddUint64(&total, 1)
|
||||
defer atomic.AddUint64(&finished, 1)
|
||||
ct := sender.GetContent()
|
||||
|
||||
@@ -49,7 +49,10 @@ func fetch(vm *goja.Runtime, wts ...interface{}) (interface{}, error) {
|
||||
if f, ok := props[i].(func(i goja.FunctionCall) goja.Value); ok {
|
||||
url = f(goja.FunctionCall{}).ToString().String()
|
||||
} else {
|
||||
url = props[i].(string)
|
||||
if props[i] == nil {
|
||||
panic(Error(vm, "无效的url请求地址nil"))
|
||||
}
|
||||
url = fmt.Sprint(props[i])
|
||||
}
|
||||
case "json":
|
||||
if props[i].(bool) {
|
||||
|
||||
Reference in New Issue
Block a user