创建频道公告推荐子频道

用于将指定子频道设置为当前频道的推荐子频道,并以全局公告形式展示。

::: warning 注意

  • 同频道内推荐子频道最多只能创建 3 条。
  • 推荐子频道和全局公告不能同时存在,会互相顶替设置。
  • 只有子频道权限为全体成员可见才可设置为推荐子频道。
  • 删除频道公告推荐子频道请使用 删除频道公告,并将 messageId 设置为 all

:::

使用示例

  1. token := token.BotToken("appid", "token")
  2. api := botgo.NewOpenAPI(token).WithTimeout(3 * time.Second)
  3. ctx := context.Background()
  4. announces, err := api.CreateGuildAnnounces(ctx, guildId, &dto.GuildAnnouncesToCreate{
  5. RecommendChannels: []dto.RecommendChannel{
  6. {
  7. ChannelID: channelId,
  8. Introduce: "推荐",
  9. },
  10. },
  11. })
  12. if err != nil {
  13. log.Fatalln("调用 CreateGuildAnnounces 接口失败, err = ", err)
  14. }

参数说明

字段名 必填 类型 描述
guildId string 频道 ID
GuildAnnouncesToCreate GuildAnnouncesToCreate 推荐子频道列表

GuildAnnouncesToCreate

字段名 必填 类型 描述
RecommendChannels [] RecommendChannel 推荐子频道列表

RecommendChannel

字段名 类型 描述
ChannelID string 子频道 ID
Introduce string 推荐语

返回说明

返回 Announces 对象。

Announces

字段名 类型 描述
GuildID string 频道 ID
ChannelID string 子频道 ID
MessageID string 消息 ID
AnnouncesType uint32 公告类别 0:成员公告,1:欢迎公告,默认为成员公告
RecommendChannels [] RecommendChannel 推荐子频道列表

返回示例

data

  1. {
  2. "guild_id": "xxxxxx",
  3. "channel_id": "xxxxx",
  4. "message_id": "",
  5. "announces_type": 0,
  6. "recommend_channels": [
  7. {
  8. "channel_id": "xxxx",
  9. "introduce": "推荐语"
  10. },
  11. {
  12. "channel_id": "xxxx",
  13. "introduce": "推荐语"
  14. }
  15. ]
  16. }