Преглед изворни кода

Add `Message.isPlain`, `Message.isNotPlain`

Him188 пре 5 година
родитељ
комит
f845b5cded
1 измењених фајлова са 3 додато и 0 уклоњено
  1. 3 0
      mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Message.kt

+ 3 - 0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Message.kt

@@ -214,6 +214,9 @@ interface Message {
         this.followedByInternalForBinaryCompatibility(another.toString().toMessage())
         this.followedByInternalForBinaryCompatibility(another.toString().toMessage())
 }
 }
 
 
+inline fun Message.isPlain(): Boolean = this is PlainText
+
+inline fun Message.isNotPlain(): Boolean = this !is PlainText
 
 
 @JvmSynthetic
 @JvmSynthetic
 @Suppress("UNCHECKED_CAST")
 @Suppress("UNCHECKED_CAST")