Skip to content

Commit 8e87be2

Browse files
committed
fix(aichat): agent group send
1 parent 8811df5 commit 8e87be2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

plugin/aichat/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package aichat
44
import (
55
"errors"
66
"math/rand"
7+
"reflect"
78
"strconv"
89
"strings"
910
"time"
@@ -160,11 +161,12 @@ func init() {
160161
logrus.Infoln("[aichat] agent do:", reqs)
161162
for _, req := range reqs {
162163
if req.Action == "send_group_msg" {
163-
gid, ok := req.Params["group_id"].(int64)
164-
if !ok {
164+
v := reflect.ValueOf(req.Params["group_id"])
165+
if !v.CanInt() {
165166
logrus.Warnln("[aichat] invalid", req.Action, req.Params)
166167
continue
167168
}
169+
gid = v.Int()
168170
if ctx.Event.GroupID != gid && !zero.SuperUserPermission(ctx) {
169171
logrus.Warnln("[aichat] refuse to send out of grp from", ctx.Event.GroupID, "to", gid)
170172
continue

0 commit comments

Comments
 (0)