From 3a47e2e2557adb91053497d6dd2ac6adf99fefe0 Mon Sep 17 00:00:00 2001 From: Him188 Date: Fri, 17 Jan 2020 11:57:14 +0800 Subject: [PATCH] Add toString override --- .../commonMain/kotlin/net.mamoe.mirai/message/data/Message.kt | 2 ++ .../kotlin/net.mamoe.mirai/message/data/MessageChain.kt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Message.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Message.kt index 6b835787d..767ef4db5 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Message.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Message.kt @@ -80,6 +80,8 @@ interface Message { else MessageChainImpl(this, tail) } + override fun toString(): String + operator fun plus(another: Message): MessageChain = this.followedBy(another) operator fun plus(another: String): MessageChain = this.followedBy(another.toString().toMessage()) // `+ ""` will be resolved to `plus(String)` instead of `plus(CharSeq)` diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt index 8b5b49be4..2cca4c404 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt @@ -32,6 +32,8 @@ interface MessageChain : Message, MutableList { this.plusAssign(plain.toMessage()) } + override fun toString(): String + /** * 获取第一个类型为 [key] 的 [Message] 实例 *