MessageSendApi

发送消息

  • 要求操作人在该子频道具有发送消息的权限。

  • 发送成功之后,会触发一个创建消息的事件。

  • 被动回复消息有效期为 5 分钟

  • 主动推送消息每日每个子频道限 2 条

  • 发送消息接口要求机器人接口需要链接到websocket gateway 上保持在线状态


发送模板消息

  • 要求操作人在该子频道具有发送消息和 模板消息 的权限。

  • 调用前需要先申请消息模板,这一步会得到一个模板id,在请求时填在ark.template_id上

  • 发送成功之后,会触发一个创建消息的事件。

  • 可用模板参考 可用模板

content, embed, ark, image/MessageSendApi.fileImage, markdown

Author

ForteScarlet

Constructors

Link copied to clipboard
fun MessageSendApi(channelId: ID, content: String, msgId: ID? = null)
Link copied to clipboard
fun MessageSendApi(channelId: ID, embed: TencentMessage.Embed, msgId: ID? = null)
Link copied to clipboard
fun MessageSendApi(channelId: ID, ark: TencentMessage.Ark, msgId: ID? = null)
Link copied to clipboard
fun MessageSendApi(channelId: ID, sendingBody: TencentMessageForSending, fileImage: Resource? = null)
Link copied to clipboard
fun MessageSendApi(channelId: ID, fileImage: Resource)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open suspend fun doRequest(client: HttpClient, server: Url, token: String, decoder: StringFormat = Json): TencentMessage

使用此api发起一次请求,并得到预期中的结果。如果返回了代表错误的响应值

Link copied to clipboard
open fun post(resp: TencentMessage)

Do something after resp.

Link copied to clipboard
open override fun route(builder: RouteInfoBuilder)

此请求对应的api路由路径以及路径参数。 例如:/guild/list

Properties

Link copied to clipboard
open override val body: Any

此次请求所发送的数据。为null则代表没有参数。

Link copied to clipboard
open override val method: HttpMethod

此api请求方式

Link copied to clipboard
open override val resultDeserializer: DeserializationStrategy<out TencentMessage>

得到响应值的反序列化器.

Extensions

Link copied to clipboard
suspend fun <R> TencentApi<R>.request(client: HttpClient, server: Url, token: String, decoder: StringFormat = defaultJson): R

通过提供的参数,对此api进行请求并得到最终结果。