Add toString override

This commit is contained in:
Him188 2020-01-17 11:57:14 +08:00
parent 192594896e
commit 3a47e2e255
2 changed files with 4 additions and 0 deletions

View File

@ -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)`

View File

@ -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] 实例
* *