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