mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
feat: get_guild_list api
This commit is contained in:
parent
15b396251c
commit
0ea826f0a2
23
coolq/api.go
23
coolq/api.go
@ -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
|
||||||
|
@ -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":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user