Commit 3a47e2e2 authored by Him188's avatar Him188

Add toString override

parent 19259489
...@@ -80,6 +80,8 @@ interface Message { ...@@ -80,6 +80,8 @@ interface Message {
else MessageChainImpl(this, tail) else MessageChainImpl(this, tail)
} }
override fun toString(): String
operator fun plus(another: Message): MessageChain = this.followedBy(another) operator fun plus(another: Message): MessageChain = this.followedBy(another)
operator fun plus(another: String): MessageChain = this.followedBy(another.toString().toMessage()) operator fun plus(another: String): MessageChain = this.followedBy(another.toString().toMessage())
// `+ ""` will be resolved to `plus(String)` instead of `plus(CharSeq)` // `+ ""` will be resolved to `plus(String)` instead of `plus(CharSeq)`
......
...@@ -32,6 +32,8 @@ interface MessageChain : Message, MutableList<Message> { ...@@ -32,6 +32,8 @@ interface MessageChain : Message, MutableList<Message> {
this.plusAssign(plain.toMessage()) this.plusAssign(plain.toMessage())
} }
override fun toString(): String
/** /**
* 获取第一个类型为 [key] 的 [Message] 实例 * 获取第一个类型为 [key] 的 [Message] 实例
* *
......
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