Commit 10583776 authored by Him188's avatar Him188

Support AtAll in message.first()

parent 7000cdec
...@@ -14,7 +14,7 @@ package net.mamoe.mirai.message.data ...@@ -14,7 +14,7 @@ package net.mamoe.mirai.message.data
* *
* @see At at 单个群成员 * @see At at 单个群成员
*/ */
object AtAll : Message { object AtAll : Message, Message.Key<AtAll> {
override fun toString(): String = "@全体成员" override fun toString(): String = "@全体成员"
// 自动为消息补充 " " // 自动为消息补充 " "
......
...@@ -155,6 +155,7 @@ inline fun <reified M : Message> MessageChain.any(): Boolean = this.any { it is ...@@ -155,6 +155,7 @@ inline fun <reified M : Message> MessageChain.any(): Boolean = this.any { it is
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
fun <M : Message> MessageChain.firstOrNull(key: Message.Key<M>): M? = when (key) { fun <M : Message> MessageChain.firstOrNull(key: Message.Key<M>): M? = when (key) {
At -> first<At>() At -> first<At>()
AtAll -> first<AtAll>()
PlainText -> first<PlainText>() PlainText -> first<PlainText>()
Image -> first<Image>() Image -> first<Image>()
Face -> first<Face>() Face -> first<Face>()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment