From 5f0fb0f2bb2500069d897e51e56264afe81472ca Mon Sep 17 00:00:00 2001 From: Redmomn <109732988+Redmomn@users.noreply.github.com> Date: Sat, 5 Oct 2024 16:42:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=EF=BC=8C=E5=A2=9E=E5=8A=A0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=BE=A4=E6=88=90=E5=91=98=E4=BF=A1=E6=81=AF=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- coolq/bot.go | 12 +++--------- coolq/converter.go | 24 +++++++++++------------- go.mod | 2 +- go.sum | 3 +++ 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/coolq/bot.go b/coolq/bot.go index 8cb685ee0..c6cac2684 100644 --- a/coolq/bot.go +++ b/coolq/bot.go @@ -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 { @@ -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) @@ -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) diff --git a/coolq/converter.go b/coolq/converter.go index 0dafe24e5..da293ac2d 100644 --- a/coolq/converter.go +++ b/coolq/converter.go @@ -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, } diff --git a/go.mod b/go.mod index a5226d976..92761c674 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 7fa339708..07d0046dd 100644 --- a/go.sum +++ b/go.sum @@ -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= @@ -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=