From 1cfe61dd4c7f5bbb304ec83f44e82ae87428e84f Mon Sep 17 00:00:00 2001 From: sandtechnology Date: Fri, 18 Dec 2020 18:32:50 +0800 Subject: [PATCH] Lazy name val --- mirai-core-api/src/commonMain/kotlin/message/data/Face.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/Face.kt b/mirai-core-api/src/commonMain/kotlin/message/data/Face.kt index c401f5642..be245e06b 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/Face.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/Face.kt @@ -26,7 +26,7 @@ public data class Face(public val id: Int) : // used in delegation MessageContent, CodableMessage { public override fun toString(): String = "[mirai:face:$id]"; - public val name: String = contentToString().let { it.substring(1, it.length - 1) } + public val name: String get() = contentToString().let { it.substring(1, it.length - 1) } public override fun contentToString(): String = names.getOrElse(id) { "[表情]" } public override fun equals(other: Any?): Boolean = other is Face && other.id == this.id