Skip to content

Commit

Permalink
feat: 添加部分事件,增加获取群成员信息项
Browse files Browse the repository at this point in the history
  • Loading branch information
Redmomn committed Oct 5, 2024
1 parent 9537f8d commit 5f0fb0f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 23 deletions.
12 changes: 3 additions & 9 deletions coolq/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,24 +94,20 @@ func NewQQBot(cli *client.QQClient) *CQBot {
bot.Client.FriendRecallEvent.Subscribe(bot.friendRecallEvent)
// TODO 离线文件
//bot.Client.OfflineFileEvent.Subscribe(bot.offlineFileEvent)
// TODO bot加群
bot.Client.GroupJoinEvent.Subscribe(bot.joinGroupEvent)
// TODO bot退群
bot.Client.GroupLeaveEvent.Subscribe(bot.leaveGroupEvent)
bot.Client.GroupMemberJoinEvent.Subscribe(bot.memberJoinEvent)
bot.Client.GroupMemberLeaveEvent.Subscribe(bot.memberLeaveEvent)
// TODO 群成员权限变更
//bot.Client.GroupMemberPermissionChangedEvent.Subscribe(bot.memberPermissionChangedEvent)
bot.Client.GroupMemberPermissionChangedEvent.Subscribe(bot.memberPermissionChangedEvent)
// TODO 群成员名片更新
//bot.Client.MemberCardUpdatedEvent.Subscribe(bot.memberCardUpdatedEvent)
bot.Client.NewFriendRequestEvent.Subscribe(bot.friendRequestEvent)
// TODO 成为好友
//bot.Client.NewFriendEvent.Subscribe(bot.friendAddedEvent)
//bot.Client.GroupInvitedEvent.Subscribe(bot.groupInvitedEvent)
//bot.Client.GroupMemberJoinRequestEvent.Subscribe(bot.groupJoinReqEvent)
bot.Client.GroupInvitedEvent.Subscribe(bot.groupInvitedEvent)
bot.Client.GroupMemberJoinRequestEvent.Subscribe(bot.groupJoinReqEvent)
// TODO 客户端变更
//bot.Client.OtherClientStatusChangedEvent.Subscribe(bot.otherClientStatusChangedEvent)
// TODO 精华消息
bot.Client.GroupDigestEvent.Subscribe(bot.groupEssenceMsg)
go func() {
if base.HeartbeatInterval == 0 {
Expand Down Expand Up @@ -187,7 +183,6 @@ func (bot *CQBot) uploadLocalImage(target message.Source, img *msg.LocalImage) (
return bot.Client.UploadImage(target, message.NewStreamImage(img.Stream))
}

// TODO 短视频上传
// uploadLocalVideo 上传本地短视频至群聊
func (bot *CQBot) uploadLocalVideo(target message.Source, v *msg.LocalVideo) (*message.ShortVideoElement, error) {
video, err := os.Open(v.File)
Expand Down Expand Up @@ -252,7 +247,6 @@ func (bot *CQBot) uploadMedia(target message.Source, elements []message.IMessage
*p = m
}
})
// TODO 短视频上传
case *msg.LocalVideo:
w.do(func() {
m, err := bot.uploadLocalVideo(target, e)
Expand Down
24 changes: 11 additions & 13 deletions coolq/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,20 @@ func convertGroupMemberInfo(groupID int64, m *entity.GroupMember) global.MSG {
role = "member"
}
return global.MSG{
"group_id": groupID,
"user_id": m.Uin,
"nickname": m.MemberName,
"card": m.MemberCard,
"sex": sex,
"age": 0,
"area": "",
"join_time": m.JoinTime,
"last_sent_time": m.LastMsgTime,
// TODO 这个也获取不到
"shut_up_timestamp": 0,
"group_id": groupID,
"user_id": m.Uin,
"nickname": m.MemberName,
"card": m.MemberCard,
"sex": sex,
"age": 0,
"area": "",
"join_time": m.JoinTime,
"last_sent_time": m.LastMsgTime,
"shut_up_timestamp": m.ShutUpTime,
"level": strconv.Itoa(int(m.GroupLevel)),
"role": role,
"unfriendly": false,
// TODO 等lagrengego
"title": "",
"title": m.SpecialTitle,
"title_expire_time": 0,
"card_changeable": false,
}
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-20241005062358-5cefea3b3cf7
github.com/LagrangeDev/LagrangeGo v0.0.0-20241005082947-c1dd41dacc5d
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
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1 h1:g4pTnDJUW4VbJ9Nvo
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/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 @@ -158,6 +160,7 @@ 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 5f0fb0f

Please sign in to comment.