Commit e3576fe5 authored by Him188's avatar Him188

Add `Message.repeat`, make `Message.times` inline

parent 1998b534
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
@file:Suppress("MemberVisibilityCanBePrivate", "unused", "EXPERIMENTAL_API_USAGE") @file:Suppress("MemberVisibilityCanBePrivate", "unused", "EXPERIMENTAL_API_USAGE", "NOTHING_TO_INLINE")
package net.mamoe.mirai.message.data package net.mamoe.mirai.message.data
...@@ -115,12 +115,14 @@ suspend inline fun <C : Contact> Message.sendTo(contact: C): MessageReceipt<C> { ...@@ -115,12 +115,14 @@ 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 { fun Message.repeat(count: Int): MessageChain {
return buildMessageChain(count) { return buildMessageChain(count) {
add(this@times) add(this@repeat)
} }
} }
inline operator fun Message.times(count: Int): MessageChain = this.repeat(count)
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