Commit 1998b534 authored by Him188's avatar Him188

Add `Message.times`

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