1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-04 19:17:37 +08:00

feat: get_guild_list api

This commit is contained in:
Mrs4s 2021-11-07 16:20:57 +08:00
parent 15b396251c
commit 0ea826f0a2
No known key found for this signature in database
GPG Key ID: 3186E98FA19CE3A7
2 changed files with 25 additions and 0 deletions

View File

@ -60,6 +60,29 @@ func (bot *CQBot) CQGetGuildServiceProfile() global.MSG {
}) })
} }
// CQGetGuildList 获取已加入的频道列表
// @route(get_guild_list)
func (bot *CQBot) CQGetGuildList() global.MSG {
fs := make([]global.MSG, 0, len(bot.Client.GuildService.Guilds))
for _, info := range bot.Client.GuildService.Guilds {
channels := make([]global.MSG, len(info.Channels))
for _, channel := range info.Channels {
channels = append(channels, global.MSG{
"channel_id": channel.ChannelId,
"channel_name": channel.ChannelName,
"channel_type": channel.ChannelType,
})
}
fs = append(fs, global.MSG{
"guild_id": info.GuildId,
"guild_name": info.GuildName,
"guild_display_id": info.GuildCode,
"channels": channels,
})
}
return OK(fs)
}
// CQGetFriendList 获取好友列表 // CQGetFriendList 获取好友列表
// //
// https://git.io/Jtz1L // https://git.io/Jtz1L

View File

@ -123,6 +123,8 @@ func (c *Caller) call(action string, p Getter) global.MSG {
return c.bot.CQGetGroupRootFiles(p0) return c.bot.CQGetGroupRootFiles(p0)
case "get_group_system_msg": case "get_group_system_msg":
return c.bot.CQGetGroupSystemMessages() return c.bot.CQGetGroupSystemMessages()
case "get_guild_list":
return c.bot.CQGetGuildList()
case "get_guild_service_profile": case "get_guild_service_profile":
return c.bot.CQGetGuildServiceProfile() return c.bot.CQGetGuildServiceProfile()
case "get_image": case "get_image":