From 3eade331bfbbdd83361a1ac2319e5de61645f712 Mon Sep 17 00:00:00 2001 From: Mrs4s Date: Tue, 7 Dec 2021 13:50:51 +0800 Subject: [PATCH] update dep --- coolq/api.go | 20 ++------------------ coolq/event.go | 15 +++++---------- go.mod | 2 +- go.sum | 6 ++---- 4 files changed, 10 insertions(+), 33 deletions(-) diff --git a/coolq/api.go b/coolq/api.go index 687ff47..372d52f 100644 --- a/coolq/api.go +++ b/coolq/api.go @@ -135,23 +135,7 @@ func (bot *CQBot) CQGetGuildMembers(guildID uint64) global.MSG { if guild == nil { return Failed(100, "GUILD_NOT_FOUND") } - members := make([]global.MSG, len(guild.Members)) - bots := make([]global.MSG, len(guild.Bots)) - admins := make([]global.MSG, len(guild.Admins)) - for i, m := range guild.Members { - members[i] = convertGuildMemberInfo(m) - } - for i, m := range guild.Bots { - bots[i] = convertGuildMemberInfo(m) - } - for i, m := range guild.Admins { - admins[i] = convertGuildMemberInfo(m) - } - return OK(global.MSG{ - "members": members, - "bots": bots, - "admins": admins, - }) + return OK(nil) // todo } // CQGetGuildRoles 获取频道角色列表 @@ -692,7 +676,7 @@ func (bot *CQBot) CQSendGuildChannelMessage(guildID, channelID uint64, m gjson.R fixAt := func(elem []message.IMessageElement) { for _, e := range elem { if at, ok := e.(*message.AtElement); ok && at.Target != 0 && at.Display == "" { - mem := guild.FindMember(uint64(at.Target)) + mem, _ := bot.Client.GuildService.GetGuildMemberProfileInfo(guildID, uint64(at.Target)) if mem != nil { at.Display = "@" + mem.Nickname } else { diff --git a/coolq/event.go b/coolq/event.go index 1db0b29..82a6fe1 100644 --- a/coolq/event.go +++ b/coolq/event.go @@ -148,12 +148,7 @@ func (bot *CQBot) guildChannelMessageEvent(c *client.QQClient, m *message.GuildC if guild == nil { return } - var channel *client.ChannelInfo - for _, c := range guild.Channels { - if c.ChannelId == m.ChannelId { - channel = c - } - } + channel := guild.FindChannel(m.ChannelId) source := MessageSource{ SourceType: MessageSourceGuildChannel, PrimaryID: m.GuildId, @@ -244,9 +239,9 @@ func (bot *CQBot) guildChannelCreatedEvent(c *client.QQClient, e *client.GuildCh if guild == nil { return } - member := guild.FindMember(e.OperatorId) + member, _ := c.GuildService.GetGuildMemberProfileInfo(e.GuildId, e.OperatorId) if member == nil { - member = &client.GuildMemberInfo{Nickname: "未知"} + member = &client.GuildUserProfile{Nickname: "未知"} } log.Infof("频道 %v(%v) 内用户 %v(%v) 创建了子频道 %v(%v)", guild.GuildName, guild.GuildId, member.Nickname, member.TinyId, e.ChannelInfo.ChannelName, e.ChannelInfo.ChannelId) bot.dispatchEventMessage(global.MSG{ @@ -268,9 +263,9 @@ func (bot *CQBot) guildChannelDestroyedEvent(c *client.QQClient, e *client.Guild if guild == nil { return } - member := guild.FindMember(e.OperatorId) + member, _ := c.GuildService.GetGuildMemberProfileInfo(e.GuildId, e.OperatorId) if member == nil { - member = &client.GuildMemberInfo{Nickname: "未知"} + member = &client.GuildUserProfile{Nickname: "未知"} } log.Infof("频道 %v(%v) 内用户 %v(%v) 删除了子频道 %v(%v)", guild.GuildName, guild.GuildId, member.Nickname, member.TinyId, e.ChannelInfo.ChannelName, e.ChannelInfo.ChannelId) bot.dispatchEventMessage(global.MSG{ diff --git a/go.mod b/go.mod index 8909ff3..be28ff0 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.17 require ( github.com/Baozisoftware/qrcode-terminal-go v0.0.0-20170407111555-c0650d8dff0f github.com/Microsoft/go-winio v0.5.1 - github.com/Mrs4s/MiraiGo v0.0.0-20211201170411-c0713ba75d7f + github.com/Mrs4s/MiraiGo v0.0.0-20211207052901-2d17133a7b38 github.com/dustin/go-humanize v1.0.0 github.com/fumiama/go-hide-param v0.1.4 github.com/gabriel-vasile/mimetype v1.4.0 diff --git a/go.sum b/go.sum index d3d1849..80f5e89 100644 --- a/go.sum +++ b/go.sum @@ -3,10 +3,8 @@ github.com/Baozisoftware/qrcode-terminal-go v0.0.0-20170407111555-c0650d8dff0f/g github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Microsoft/go-winio v0.5.1 h1:aPJp2QD7OOrhO5tQXqQoGSJc+DjDtWTGLOmNyAm6FgY= github.com/Microsoft/go-winio v0.5.1/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= -github.com/Mrs4s/MiraiGo v0.0.0-20211201170411-c0713ba75d7f h1:kiNClkzBUTj7z0INLxyN8pRXuPSy0gPGv/dXpSKVfmE= -github.com/Mrs4s/MiraiGo v0.0.0-20211201170411-c0713ba75d7f/go.mod h1:xh9dqJAblNEQnZQSrMj216jF3GkrkoWOzkpBjGoZiiY= -github.com/RomiChan/protobuf v0.0.0-20211126015646-ee3d29b19e08 h1:VAR3nNyBAc+oPlLKihkLTP0GXf8bQi085y2pSrNzAF0= -github.com/RomiChan/protobuf v0.0.0-20211126015646-ee3d29b19e08/go.mod h1:lM1Te2wqdBLPSF7QLaskSn1fGW3Tw2l0iFGsTHTxqIg= +github.com/Mrs4s/MiraiGo v0.0.0-20211207052901-2d17133a7b38 h1:IJg8tgGzHg/95Rav7zf33iB2Wx+pqiAnAanaM3Iw7Ug= +github.com/Mrs4s/MiraiGo v0.0.0-20211207052901-2d17133a7b38/go.mod h1:YD9gBKkxC9lPPtx3doYXRG26VBkK6YXjrS76cv01C5w= github.com/RomiChan/protobuf v0.0.0-20211204042931-ff4f35848737 h1:p4o7/eSoP39jwnGZz08N1IpH/mNzg9SdCn7kPM9A9BE= github.com/RomiChan/protobuf v0.0.0-20211204042931-ff4f35848737/go.mod h1:CKKOWC7mBxd36zxsCB1V8DTrwlTNRQvkSVbYqyUiGEE= github.com/bits-and-blooms/bitset v1.2.1 h1:M+/hrU9xlMp7t4TyTDQW97d3tRPVuKFC6zBEK16QnXY=