Add Message.repeat, make Message.times inline

This commit is contained in:
Him188 2020-03-08 19:26:15 +08:00
parent 1998b53451
commit e3576fe5d0

View File

@ -7,7 +7,7 @@
* 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
@ -115,12 +115,14 @@ suspend inline fun <C : Contact> Message.sendTo(contact: C): MessageReceipt<C> {
return contact.sendMessage(this)
}
operator fun Message.times(count: Int): MessageChain {
fun Message.repeat(count: Int): MessageChain {
return buildMessageChain(count) {
add(this@times)
add(this@repeat)
}
}
inline operator fun Message.times(count: Int): MessageChain = this.repeat(count)
interface SingleMessage : Message
/**