Commit 4700c48d authored by Him188's avatar Him188

Unified toString

parent f322af71
...@@ -39,7 +39,7 @@ private constructor(val target: Long, val display: String) : ...@@ -39,7 +39,7 @@ private constructor(val target: Long, val display: String) :
*/ */
constructor(member: Member) : this(member.id, "@${member.nameCardOrNick}") constructor(member: Member) : this(member.id, "@${member.nameCardOrNick}")
override fun toString(): String = display override fun toString(): String = "[mirai:at:$target]"
companion object Key : Message.Key<At> { companion object Key : Message.Key<At> {
/** /**
......
...@@ -30,7 +30,8 @@ object AtAll : ...@@ -30,7 +30,8 @@ object AtAll :
CharSequence by display, CharSequence by display,
Comparable<String> by display { Comparable<String> by display {
override fun toString(): String = display @Suppress("SpellCheckingInspection")
override fun toString(): String = "[mirai:atall]"
// 自动为消息补充 " " // 自动为消息补充 " "
......
...@@ -22,9 +22,9 @@ class Face private constructor(val id: Int, private val stringValue: String) : ...@@ -22,9 +22,9 @@ class Face private constructor(val id: Int, private val stringValue: String) :
MessageContent, MessageContent,
CharSequence by stringValue, Comparable<String> by stringValue { CharSequence by stringValue, Comparable<String> by stringValue {
constructor(id: Int) : this(id, "[mirai:face$id]") constructor(id: Int) : this(id, "[mirai:face:$id]")
override fun toString(): String = "[mirai:face$id]" override fun toString(): String = stringValue
/** /**
* @author LamGC * @author LamGC
......
...@@ -59,7 +59,7 @@ class PokeMessage @MiraiInternalAPI(message = "使用伴生对象中的常量") ...@@ -59,7 +59,7 @@ class PokeMessage @MiraiInternalAPI(message = "使用伴生对象中的常量")
} }
@OptIn(MiraiExperimentalAPI::class) @OptIn(MiraiExperimentalAPI::class)
private val stringValue = "[mirai:Poke($type, $id)]" private val stringValue = "[mirai:poke:$type,$id]"
override fun toString(): String = stringValue override fun toString(): String = stringValue
override val length: Int get() = stringValue.length override val length: Int get() = stringValue.length
......
...@@ -63,7 +63,7 @@ abstract class AbstractImage internal constructor() : Image { ...@@ -63,7 +63,7 @@ abstract class AbstractImage internal constructor() : Image {
private var _stringValue: String? = null private var _stringValue: String? = null
get() { get() {
return field ?: kotlin.run { return field ?: kotlin.run {
field = "[mirai:$imageId]" field = "[mirai:image:$imageId]"
field field
} }
} }
......
...@@ -33,7 +33,7 @@ open class QuoteReply ...@@ -33,7 +33,7 @@ open class QuoteReply
@MiraiInternalAPI constructor(val source: MessageSource) : Message, MessageMetadata { @MiraiInternalAPI constructor(val source: MessageSource) : Message, MessageMetadata {
companion object Key : Message.Key<QuoteReply> companion object Key : Message.Key<QuoteReply>
final override fun toString(): String = "" final override fun toString(): String = "[mirai:quote]"
} }
/** /**
......
...@@ -119,7 +119,7 @@ class JsonMessage(override val content: String) : RichMessage { ...@@ -119,7 +119,7 @@ class JsonMessage(override val content: String) : RichMessage {
companion object Key : Message.Key<JsonMessage> companion object Key : Message.Key<JsonMessage>
// serviceId = 1 // serviceId = 1
override fun toString(): String = content override fun toString(): String = "[mirai:json:$content]"
} }
/** /**
...@@ -131,7 +131,7 @@ class LightApp constructor(override val content: String) : RichMessage { ...@@ -131,7 +131,7 @@ class LightApp constructor(override val content: String) : RichMessage {
companion object Key : Message.Key<LightApp> companion object Key : Message.Key<LightApp>
override fun toString(): String = content override fun toString(): String = "[mirai:app:$content]"
} }
...@@ -147,7 +147,7 @@ class XmlMessage constructor(override val content: String) : RichMessage { ...@@ -147,7 +147,7 @@ class XmlMessage constructor(override val content: String) : RichMessage {
// override val serviceId: Int get() = 60 // override val serviceId: Int get() = 60
override fun toString(): String = content override fun toString(): String = "[mirai:xml:$content]"
} }
/** /**
...@@ -160,7 +160,7 @@ class LongMessage(override val content: String, val resId: String) : RichMessage ...@@ -160,7 +160,7 @@ class LongMessage(override val content: String, val resId: String) : RichMessage
companion object Key : Message.Key<XmlMessage> companion object Key : Message.Key<XmlMessage>
// serviceId = 35 // serviceId = 35
override fun toString(): String = content override fun toString(): String = "[mirai:long:$content]"
} }
/* /*
......
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