Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions coolq/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,15 @@ func (bot *CQBot) joinGroupEvent(c *client.QQClient, event *event2.GroupMemberIn
}

func (bot *CQBot) leaveGroupEvent(c *client.QQClient, e *event2.GroupMemberDecrease) {
group := c.GetCachedGroupInfo(e.GroupUin)
var op *entity.GroupMember
if e.IsKicked() {
log.Infof("Bot被 %v T出了群 %v.", formatMemberName(c.GetCachedMemberInfo(e.OperatorUin, e.GroupUin)), formatGroupName(c.GetCachedGroupInfo(e.GroupUin)))
op = c.GetCachedMemberInfo(e.OperatorUin, e.GroupUin)
log.Infof("Bot 被 %v 踢出了群 %v.", formatMemberName(op), formatGroupName(group))
} else {
log.Infof("Bot退出了群 %v.", formatGroupName(c.GetCachedGroupInfo(e.GroupUin)))
log.Infof("Bot 退出了群 %v.", formatGroupName(group))
}
bot.dispatch(bot.groupDecrease(int64(e.GroupUin), int64(c.Uin), c.GetCachedMemberInfo(e.OperatorUin, e.GroupUin)))
bot.dispatch(bot.groupDecrease(int64(e.GroupUin), int64(c.Uin), op))
}

func (bot *CQBot) memberPermissionChangedEvent(_ *client.QQClient, e *event2.GroupMemberPermissionChanged) {
Expand Down Expand Up @@ -385,15 +388,16 @@ func (bot *CQBot) memberJoinEvent(c *client.QQClient, e *event2.GroupMemberIncre
}

func (bot *CQBot) memberLeaveEvent(c *client.QQClient, e *event2.GroupMemberDecrease) {
member := c.GetCachedMemberInfo(c.GetUin(e.UserUID, e.GroupUin), e.GroupUin)
op := c.GetCachedMemberInfo(c.GetUin(e.OperatorUID, e.GroupUin), e.GroupUin)
member := c.GetCachedMemberInfo(e.UserUin, e.GroupUin)
var op *entity.GroupMember
group := c.GetCachedGroupInfo(e.GroupUin)
if e.IsKicked() {
log.Infof("成员 %v 被 %v T出了群 %v.", formatMemberName(member), formatMemberName(op), formatGroupName(group))
op = c.GetCachedMemberInfo(e.OperatorUin, e.GroupUin)
log.Infof("成员 %v 被 %v 踢出了群 %v.", formatMemberName(member), formatMemberName(op), formatGroupName(group))
} else {
log.Infof("成员 %v 离开了群 %v.", formatMemberName(member), formatGroupName(group))
}
bot.dispatch(bot.groupDecrease(int64(e.GroupUin), int64(member.Uin), op))
bot.dispatch(bot.groupDecrease(int64(e.GroupUin), int64(e.UserUin), op))
}

func (bot *CQBot) friendRequestEvent(_ *client.QQClient, e *event2.NewFriendRequest) {
Expand Down Expand Up @@ -502,11 +506,9 @@ func (bot *CQBot) groupIncrease(groupCode, operatorUin, userUin int64) *event {

func (bot *CQBot) groupDecrease(groupCode, userUin int64, operator *entity.GroupMember) *event {
op := userUin
if operator != nil {
op = int64(operator.Uin)
}
subtype := "leave"
if operator != nil {
op = int64(operator.Uin)
if userUin == int64(bot.Client.Uin) {
subtype = "kick_me"
} else {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ toolchain go1.24.7

require (
github.com/FloatTech/sqlite v1.6.3
github.com/LagrangeDev/LagrangeGo v0.1.5-0.20251025062608-50907f2e480b
github.com/LagrangeDev/LagrangeGo v0.1.5-0.20251030033604-587d2268813f
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
4 changes: 2 additions & 2 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.1.5-0.20251025062608-50907f2e480b h1:SssPjgmi/2RlR6W5VLSPrec2+D4j8nGbGauEn+zQJFc=
github.com/LagrangeDev/LagrangeGo v0.1.5-0.20251025062608-50907f2e480b/go.mod h1:qwYPEv+WsrOeAKelGXbNerqY1FBZbOVK5RBRDi/jN4U=
github.com/LagrangeDev/LagrangeGo v0.1.5-0.20251030033604-587d2268813f h1:lRCs5MGWTEjxFvypEOguxKWDFN+VpYu5XQpWiTMMyDE=
github.com/LagrangeDev/LagrangeGo v0.1.5-0.20251030033604-587d2268813f/go.mod h1:qwYPEv+WsrOeAKelGXbNerqY1FBZbOVK5RBRDi/jN4U=
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
Loading