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 ad3fc94fd..b2186659e 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 @@ -106,14 +106,21 @@ interface Message { operator fun plus(another: Message): CombinedMessage = this.followedBy(another) operator fun plus(another: String): CombinedMessage = this.followedBy(another.toMessage()) + // `+ ""` will be resolved to `plus(String)` instead of `plus(CharSeq)` operator fun plus(another: CharSequence): CombinedMessage = this.followedBy(another.toString().toMessage()) } -suspend fun Message.sendTo(contact: C): MessageReceipt { +suspend inline fun Message.sendTo(contact: C): MessageReceipt { return contact.sendMessage(this) } +operator fun Message.times(count: Int): MessageChain { + return buildMessageChain(count) { + add(this@times) + } +} + interface SingleMessage : Message /**