diff --git a/client/client.go b/client/client.go index 1d89bba8..103cf372 100644 --- a/client/client.go +++ b/client/client.go @@ -1016,13 +1016,11 @@ func (c *QQClient) netLoop() { if err != nil { c.Debug("decode pkt %v error: %+v", pkt.CommandName, err) } - if f, ok := c.handlers.Load(pkt.SequenceId); ok { - c.handlers.Delete(pkt.SequenceId) + if f, ok := c.handlers.LoadAndDelete(pkt.SequenceId); ok { f.(func(i interface{}, err error))(rsp, err) } - } else if f, ok := c.handlers.Load(pkt.SequenceId); ok { + } else if f, ok := c.handlers.LoadAndDelete(pkt.SequenceId); ok { // does not need decoder - c.handlers.Delete(pkt.SequenceId) f.(func(i interface{}, err error))(nil, nil) } else { c.Debug("\nUnhandled Command: %s\nSeq: %d\nThis message can be ignored.", pkt.CommandName, pkt.SequenceId) diff --git a/client/notify.go b/client/notify.go index 41508fff..af447932 100644 --- a/client/notify.go +++ b/client/notify.go @@ -2,8 +2,9 @@ package client import ( "fmt" - "github.com/Mrs4s/MiraiGo/client/pb/notify" "strconv" + + "github.com/Mrs4s/MiraiGo/client/pb/notify" ) type ( diff --git a/go.mod b/go.mod index 0f0a1d10..e5cab35d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/Mrs4s/MiraiGo -go 1.14 +go 1.15 require ( github.com/golang/protobuf v1.4.3