mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-06 12:03:50 +08:00
feat: get_guild_meta_by_guest api
This commit is contained in:
parent
0ea826f0a2
commit
f316278c57
24
coolq/api.go
24
coolq/api.go
@ -65,7 +65,7 @@ func (bot *CQBot) CQGetGuildServiceProfile() global.MSG {
|
||||
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))
|
||||
channels := make([]global.MSG, 0, len(info.Channels))
|
||||
for _, channel := range info.Channels {
|
||||
channels = append(channels, global.MSG{
|
||||
"channel_id": channel.ChannelId,
|
||||
@ -83,6 +83,28 @@ func (bot *CQBot) CQGetGuildList() global.MSG {
|
||||
return OK(fs)
|
||||
}
|
||||
|
||||
// CQGetGuildMetaByGuest 通过访客权限获取频道元数据
|
||||
// @route(get_guild_meta_by_guest)
|
||||
// @rename(guildId->guild_id)
|
||||
func (bot *CQBot) CQGetGuildMetaByGuest(guildId int64) global.MSG {
|
||||
meta, err := bot.Client.GuildService.FetchGuestGuild(uint64(guildId))
|
||||
if err != nil {
|
||||
log.Errorf("获取频道元数据时出现错误: %v", err)
|
||||
return Failed(100, "API_ERROR", err.Error())
|
||||
}
|
||||
return OK(global.MSG{
|
||||
"guild_id": meta.GuildId,
|
||||
"guild_name": meta.GuildName,
|
||||
"guild_profile": meta.GuildProfile,
|
||||
"create_time": meta.CreateTime,
|
||||
"max_member_count": meta.MaxMemberCount,
|
||||
"max_robot_count": meta.MaxRobotCount,
|
||||
"max_admin_count": meta.MaxAdminCount,
|
||||
"member_count": meta.MemberCount,
|
||||
"owner_id": meta.OwnerId,
|
||||
})
|
||||
}
|
||||
|
||||
// CQGetFriendList 获取好友列表
|
||||
//
|
||||
// https://git.io/Jtz1L
|
||||
|
@ -125,6 +125,9 @@ func (c *Caller) call(action string, p Getter) global.MSG {
|
||||
return c.bot.CQGetGroupSystemMessages()
|
||||
case "get_guild_list":
|
||||
return c.bot.CQGetGuildList()
|
||||
case "get_guild_meta_by_guest":
|
||||
p0 := p.Get("guild_id").Int()
|
||||
return c.bot.CQGetGuildMetaByGuest(p0)
|
||||
case "get_guild_service_profile":
|
||||
return c.bot.CQGetGuildServiceProfile()
|
||||
case "get_image":
|
||||
|
Loading…
x
Reference in New Issue
Block a user