创建精华消息

用于将messageId添加为子频道 channelId 内的精华消息。

::: warning 注意

  • 精华消息在一个子频道内最多只能创建 20 条。
  • 只有可见的消息才能被设置为精华消息。
  • 接口返回对象中 message_ids 为当前请求后子频道内所有精华消息 message_id 数组。

:::

使用示例

sync

  1. import qqbot
  2. token = qqbot.Token({appid}, {token})
  3. def demo():
  4. api = qqbot.PinsAPI(token, IS_SANDBOX)
  5. result = api.put_pin(channel_id, message_id)

async

  1. import qqbot
  2. token = qqbot.Token({appid}, {token})
  3. async def demo():
  4. api = qqbot.AsyncPinsAPI(token, IS_SANDBOX)
  5. result = await api.put_pin(channel_id, message_id)

参数说明

字段名 必填 类型 描述
channel_id string 子频道 ID
message_id string 消息 ID

返回说明

返回 PinsMessage 对象。

PinsMessage

字段名 类型 描述
guild_id string 频道 ID
channel_id string 子频道 ID
message_ids string 列表 消息 ID 列表

返回示例

data

  1. {
  2. "guild_id": "xxxxxx",
  3. "channel_id": "xxxxxx",
  4. "message_ids": ["xxxxx"]
  5. }