1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-05 03:23:49 +08:00

fix: don't listenAPI in Event connection

bug introduced by last commit
This commit is contained in:
wdvxdr 2021-11-17 11:49:33 +08:00
parent dba2bf2881
commit c478870870
No known key found for this signature in database
GPG Key ID: 703F8C071DE7A1B6

View File

@ -162,7 +162,9 @@ func (c *websocketClient) connect(typ, url string, conptr **wsConn) {
*conptr = wrappedConn *conptr = wrappedConn
} }
go c.listenAPI(typ, url, wrappedConn) if typ != "Event" {
go c.listenAPI(typ, url, wrappedConn)
}
} }
func (c *websocketClient) listenAPI(typ, url string, conn *wsConn) { func (c *websocketClient) listenAPI(typ, url string, conn *wsConn) {
@ -347,8 +349,8 @@ func (c *wsConn) handleRequest(_ *coolq.CQBot, payload []byte) {
} }
func (s *webSocketServer) onBotPushEvent(e *coolq.Event) { func (s *webSocketServer) onBotPushEvent(e *coolq.Event) {
filter := filter.Find(s.filter) flt := filter.Find(s.filter)
if filter != nil && !filter.Eval(gjson.Parse(e.JSONString())) { if flt != nil && !flt.Eval(gjson.Parse(e.JSONString())) {
log.Debugf("上报Event %s 到 WS客户端 时被过滤.", e.JSONBytes()) log.Debugf("上报Event %s 到 WS客户端 时被过滤.", e.JSONBytes())
return return
} }