mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-03 12:32:28 +08:00
Add docs
This commit is contained in:
parent
124cd0db74
commit
f236135e3b
@ -38,11 +38,13 @@ interface MessageChain : Message, MutableList<Message> {
|
|||||||
*
|
*
|
||||||
* @param key 由各个类型消息的伴生对象持有. 如 [PlainText.Key]
|
* @param key 由各个类型消息的伴生对象持有. 如 [PlainText.Key]
|
||||||
*/
|
*/
|
||||||
@Suppress("UNCHECKED_CAST")
|
|
||||||
operator fun <M : Message> get(key: Message.Key<M>): M = first(key)
|
operator fun <M : Message> get(key: Message.Key<M>): M = first(key)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提供一个类型的值. 若不存在则会抛出异常 [NoSuchElementException]
|
||||||
|
*/
|
||||||
inline operator fun <reified T : Message> MessageChain.getValue(thisRef: Any?, property: KProperty<*>): T = this.first<T>() as T
|
inline operator fun <reified T : Message> MessageChain.getValue(thisRef: Any?, property: KProperty<*>): T = this.first<T>() as T
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user