Skip to content

Commit

Permalink
fix: 更新上游,优化获取群系统消息
Browse files Browse the repository at this point in the history
  • Loading branch information
Redmomn committed Oct 6, 2024
1 parent 8b89eb8 commit ff01126
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
13 changes: 6 additions & 7 deletions coolq/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -838,33 +838,32 @@ func (bot *CQBot) CQProcessGroupRequest(flag, subType, reason string, approve bo
log.Warnf("获取群系统消息失败: %v", err)
return Failed(100, "SYSTEM_MSG_API_ERROR", err.Error())
}
msgs = append(msgs, filteredmsgs...)
if subType == "add" {
for _, req := range msgs {
for _, req := range append(msgs.JoinRequests, filteredmsgs.JoinRequests...) {
if strconv.FormatInt(int64(req.Sequence), 10) == flag {
if req.Checked() {
log.Warnf("处理群系统消息失败: 无法操作已处理的消息.")
return Failed(100, "FLAG_HAS_BEEN_CHECKED", "消息已被处理")
}
if approve {
_ = bot.Client.SetGroupRequest(req.IsFiltered, true, req.Sequence, req.EventType, req.GroupUin, "")
_ = bot.Client.SetGroupRequest(req.IsFiltered, true, req.Sequence, uint32(req.EventType), req.GroupUin, "")
} else {
_ = bot.Client.SetGroupRequest(req.IsFiltered, false, req.Sequence, req.EventType, req.GroupUin, reason)
_ = bot.Client.SetGroupRequest(req.IsFiltered, false, req.Sequence, uint32(req.EventType), req.GroupUin, reason)
}
return OK(nil)
}
}
} else {
for _, req := range msgs {
for _, req := range append(msgs.InvitedRequests, filteredmsgs.InvitedRequests...) {
if strconv.FormatInt(int64(req.Sequence), 10) == flag {
if req.Checked() {
log.Warnf("处理群系统消息失败: 无法操作已处理的消息.")
return Failed(100, "FLAG_HAS_BEEN_CHECKED", "消息已被处理")
}
if approve {
_ = bot.Client.SetGroupRequest(req.IsFiltered, true, req.Sequence, req.EventType, req.GroupUin, "")
_ = bot.Client.SetGroupRequest(req.IsFiltered, true, req.Sequence, uint32(req.EventType), req.GroupUin, "")
} else {
_ = bot.Client.SetGroupRequest(req.IsFiltered, false, req.Sequence, req.EventType, req.GroupUin, reason)
_ = bot.Client.SetGroupRequest(req.IsFiltered, false, req.Sequence, uint32(req.EventType), req.GroupUin, reason)
}
return OK(nil)
}
Expand Down
2 changes: 1 addition & 1 deletion 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-20241005142805-27377f34691c
github.com/LagrangeDev/LagrangeGo v0.0.0-20241006144137-4fc7fcb8caa1
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
9 changes: 2 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +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-20241005062358-5cefea3b3cf7 h1:0U/Vw6qQHv4SAInJNsNWdH2FL/1FiFsIDmjQkmQI+Lk=
github.com/LagrangeDev/LagrangeGo v0.0.0-20241005062358-5cefea3b3cf7/go.mod h1:qK/l75YuMYdJWfPcxPhfjybJdXD4kzMFvcbKlvdAoa0=
github.com/LagrangeDev/LagrangeGo v0.0.0-20241005082947-c1dd41dacc5d h1:OTtMJj2DPkkuqO52EuxCqjjmmko5lgX6ZUeWvyTUcCc=
github.com/LagrangeDev/LagrangeGo v0.0.0-20241005082947-c1dd41dacc5d/go.mod h1:qK/l75YuMYdJWfPcxPhfjybJdXD4kzMFvcbKlvdAoa0=
github.com/LagrangeDev/LagrangeGo v0.0.0-20241005142805-27377f34691c h1:rbzkFsatoMBr4UVOfWqM+0NuSjG6HaRrrDeidaRYD64=
github.com/LagrangeDev/LagrangeGo v0.0.0-20241005142805-27377f34691c/go.mod h1:qK/l75YuMYdJWfPcxPhfjybJdXD4kzMFvcbKlvdAoa0=
github.com/LagrangeDev/LagrangeGo v0.0.0-20241006144137-4fc7fcb8caa1 h1:qbUK72LzMKXiAHaRVVfpJLxS5eQwQsYKyrHarOp7OQM=
github.com/LagrangeDev/LagrangeGo v0.0.0-20241006144137-4fc7fcb8caa1/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 Down Expand Up @@ -162,7 +158,6 @@ golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJ
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.ilharper.com/x/isatty v1.1.1 h1:RAg32Pxq/nIK4AVtdm9RBqxsxZZX1uRKRSS21E5SHMk=
gopkg.ilharper.com/x/isatty v1.1.1/go.mod h1:ofpv77Td5qQO6R1dmDd3oNt8TZdRo+l5gYAMxopRyS0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
Expand Down

0 comments on commit ff01126

Please sign in to comment.