Skip to content

Commit

Permalink
fix: 改动一些小细节,更新lgrgo
Browse files Browse the repository at this point in the history
  • Loading branch information
Redmomn committed Aug 19, 2024
1 parent 9258096 commit 6e983ba
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
10 changes: 8 additions & 2 deletions coolq/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
"sync"
"time"

"github.com/LagrangeDev/LagrangeGo/client/sign"

"github.com/LagrangeDev/LagrangeGo/utils/binary"

"github.com/Mrs4s/go-cqhttp/internal/mime"
Expand Down Expand Up @@ -329,6 +331,10 @@ func (bot *CQBot) SendGroupMessage(groupID int64, m *message.SendingMessage) (in
bot.checkMedia(newElem, groupID)
ret, err := bot.Client.SendGroupMessage(uint32(groupID), m.Elements)
if err != nil || ret == nil {
if errors.Is(err, sign.VersionMismatchError) {
log.Warnf("群 %v 发送消息失败: 签名与当前协议版本不对应.", groupID)
return -1, err
}
log.Warnf("群 %v 发送消息失败: 账号可能被风控.", groupID)
return -1, errors.New("send group message failed: blocked by server")
}
Expand Down Expand Up @@ -379,8 +385,8 @@ func (bot *CQBot) SendPrivateMessage(target int64, groupID int64, m *message.Sen

//session, ok := bot.tempSessionCache.Load(target)
var id int32 = -1
ret, err := bot.Client.SendPrivateMessage(uint32(groupID), m.Elements)
if err != nil || ret == nil {
ret, _ := bot.Client.SendPrivateMessage(uint32(groupID), m.Elements)
if ret != nil {
id = bot.InsertPrivateMessage(ret, source)
}
//switch {
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/FloatTech/sqlite v1.6.3
github.com/LagrangeDev/LagrangeGo v0.0.0-20240818095602-b742f680598c
github.com/LagrangeDev/LagrangeGo v0.0.0-20240819212844-2dda86271a2c
github.com/Microsoft/go-winio v0.6.2-0.20230724192519-b29bbd58a65a
github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7
github.com/RomiChan/websocket v1.4.3-0.20220227141055-9b2c6168c9c5
Expand Down Expand Up @@ -33,7 +33,6 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fumiama/gofastTEA v0.0.10 // indirect
github.com/fumiama/imgsz v0.0.4 // indirect
github.com/fumiama/terasu v0.0.0-20240507144117-547a591149c0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/jonboulle/clockwork v0.3.0 // indirect
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ github.com/FloatTech/sqlite v1.6.3 h1:MQkqBNlkPuCoKQQgoNLuTL/2Ci3tBTFAnVYBdD0Wy4
github.com/FloatTech/sqlite v1.6.3/go.mod h1:zFbHzRfB+CJ+VidfjuVbrcin3DAz283F7hF1hIeHzpY=
github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1 h1:g4pTnDJUW4VbJ9NvoRfUvdjDrHz/6QhfN/LoIIpICbo=
github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1/go.mod h1:fHZFWGquNXuHttu9dUYoKuNbm3dzLETnIOnm1muSfDs=
github.com/LagrangeDev/LagrangeGo v0.0.0-20240818095602-b742f680598c h1:gAXCufjjgk46nmFeK8LKdxVfofSXQL6V/RiTRt6Njt0=
github.com/LagrangeDev/LagrangeGo v0.0.0-20240818095602-b742f680598c/go.mod h1:I3O+WRwggAvE/ndsyF4u3aau52KUnt5U8R9gLabHqws=
github.com/LagrangeDev/LagrangeGo v0.0.0-20240819212844-2dda86271a2c h1:80qtiWy/eGAv2ritpHZyIDiOTH8ueDrpvGDBlAct6Ws=
github.com/LagrangeDev/LagrangeGo v0.0.0-20240819212844-2dda86271a2c/go.mod h1:qK/l75YuMYdJWfPcxPhfjybJdXD4kzMFvcbKlvdAoa0=
github.com/Microsoft/go-winio v0.6.2-0.20230724192519-b29bbd58a65a h1:aU1703IHxupjzipvhu16qYKLMR03e+8WuNR+JMsKfGU=
github.com/Microsoft/go-winio v0.6.2-0.20230724192519-b29bbd58a65a/go.mod h1:OZqLNXdYJHmx7aqq/T6wAdFEdoGm5nmIfC4kU7M8P8o=
github.com/RomiChan/protobuf v0.1.1-0.20230204044148-2ed269a2e54d h1:/Xuj3fIiMY2ls1TwvPKmaqQrtJsPY+c9s+0lOScVHd8=
Expand All @@ -23,8 +23,6 @@ github.com/fumiama/gofastTEA v0.0.10 h1:JJJ+brWD4kie+mmK2TkspDXKzqq0IjXm89aGYfoG
github.com/fumiama/gofastTEA v0.0.10/go.mod h1:RIdbYZyB4MbH6ZBlPymRaXn3cD6SedlCu5W/HHfMPBk=
github.com/fumiama/imgsz v0.0.4 h1:Lsasu2hdSSFS+vnD+nvR1UkiRMK7hcpyYCC0FzgSMFI=
github.com/fumiama/imgsz v0.0.4/go.mod h1:bISOQVTlw9sRytPwe8ir7tAaEmyz9hSNj9n8mXMBG0E=
github.com/fumiama/terasu v0.0.0-20240507144117-547a591149c0 h1:So/3Bg/m2ZcUvqCzzEjjkjHBjcvnV3AN5tCxwsdMwYU=
github.com/fumiama/terasu v0.0.0-20240507144117-547a591149c0/go.mod h1:UVx8YP1jKKL1Cj+uy+OnQRM2Ih6U36Mqy9GSf7jabsI=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
Expand Down

0 comments on commit 6e983ba

Please sign in to comment.