mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-05 07:30:09 +08:00
Deprecate PlainText.stringValue
This commit is contained in:
parent
3d5e928382
commit
b30b508f4b
@ -13,29 +13,39 @@
|
||||
|
||||
package net.mamoe.mirai.message.data
|
||||
|
||||
import net.mamoe.mirai.utils.PlannedRemoval
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
import kotlin.jvm.JvmName
|
||||
import kotlin.jvm.JvmSynthetic
|
||||
|
||||
/**
|
||||
* 纯文本. 可含 emoji 表情.
|
||||
* 纯文本. 可含 emoji 表情如 😊.
|
||||
*
|
||||
* 一般不需要主动构造 [PlainText], [Message] 可直接与 [String] 相加. Java 用户请使用 [MessageChain.plus]
|
||||
* 一般不需要主动构造 [PlainText], [Message] 可直接与 [String] 相加. Java 用户请使用 [Message.plus]
|
||||
*/
|
||||
data class PlainText(val stringValue: String) :
|
||||
MessageContent,
|
||||
Comparable<String> by stringValue,
|
||||
CharSequence by stringValue {
|
||||
data class PlainText(
|
||||
@SinceMirai("1.0.0")
|
||||
val content: String
|
||||
) : MessageContent {
|
||||
|
||||
@PlannedRemoval("1.1.0")
|
||||
@Deprecated(
|
||||
"use content instead for clearer semantics",
|
||||
level = DeprecationLevel.WARNING,
|
||||
replaceWith = ReplaceWith("content")
|
||||
)
|
||||
val stringValue: String
|
||||
get() = content
|
||||
|
||||
@Suppress("unused")
|
||||
constructor(charSequence: CharSequence) : this(charSequence.toString())
|
||||
|
||||
override fun toString(): String = stringValue
|
||||
override fun contentToString(): String = stringValue
|
||||
override fun toString(): String = content
|
||||
override fun contentToString(): String = content
|
||||
|
||||
companion object Key : Message.Key<PlainText> {
|
||||
override val typeName: String
|
||||
get() = "PlainText"
|
||||
override val typeName: String get() = "PlainText"
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user