github.com/fumiama/NanoBot@v0.0.0-20231122134259-c22d8183efca/openapi_announces.go (about) 1 package nano 2 3 // Announces 公告对象 4 // 5 // https://bot.q.qq.com/wiki/develop/api/openapi/announces/model.html#announces 6 type Announces struct { 7 GuildID string `json:"guild_id,omitempty"` 8 ChannelID string `json:"channel_id,omitempty"` 9 MessageID string `json:"message_id,omitempty"` 10 AnnouncesType uint32 `json:"announces_type,omitempty"` // 公告类别 0:成员公告 1:欢迎公告,默认成员公告 11 RecommendChannels []RecommendChannel `json:"recommend_channels,omitempty"` 12 } 13 14 // RecommendChannel 推荐子频道对象 15 // 16 // https://bot.q.qq.com/wiki/develop/api/openapi/announces/model.html#recommendchannel 17 type RecommendChannel struct { 18 ChannelID string `json:"channel_id"` 19 Introduce string `json:"introduce"` 20 } 21 22 // PostAnnounceInGuild 创建频道全局公告,公告类型分为 消息类型的频道公告 和 推荐子频道类型的频道公告 23 // 24 // https://bot.q.qq.com/wiki/develop/api/openapi/announces/post_guild_announces.html 25 // 26 // 会重写 content 为返回值 27 func (bot *Bot) PostAnnounceInGuild(id string, content *Announces) error { 28 return bot.PostOpenAPI("/guilds/"+id+"/announces", "", content, WriteBodyFromJSON(content)) 29 } 30 31 // DeleteAnnounceInGuild 删除频道 guild_id 下指定 message_id 的全局公告 32 // 33 // https://bot.q.qq.com/wiki/develop/api/openapi/announces/delete_guild_announces.html 34 // 35 // message_id 有值时,会校验 message_id 合法性,若不校验校验 message_id,请将 message_id 设置为 all 36 func (bot *Bot) DeleteAnnounceInGuild(guildid, messageid string) error { 37 return bot.DeleteOpenAPI("/guilds/"+guildid+"/announces/"+messageid, "", nil) 38 }