From 9aa1d7d3959b20873adc314ee8a20a3e2d3dcd5d Mon Sep 17 00:00:00 2001 From: Him188 Date: Thu, 6 Feb 2020 12:44:00 +0800 Subject: [PATCH] Remove Contact.withBot --- .../kotlin/net.mamoe.mirai/contact/Contact.kt | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt index 6db064f39..d38a26aae 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt @@ -7,9 +7,6 @@ import net.mamoe.mirai.Bot import net.mamoe.mirai.message.data.* import net.mamoe.mirai.utils.ExternalImage import net.mamoe.mirai.utils.WeakRefProperty -import kotlin.contracts.ExperimentalContracts -import kotlin.contracts.InvocationKind -import kotlin.contracts.contract /** @@ -57,16 +54,4 @@ interface Contact : CoroutineScope { suspend inline fun Contact.sendMessage(message: Message) = sendMessage(message.toChain()) -suspend inline fun Contact.sendMessage(plain: String) = sendMessage(plain.singleChain()) - -/** - * 以 [Bot] 作为接收器 (receiver) 并调用 [block], 返回 [block] 的返回值. - * 这个方法将能帮助使用在 [Bot] 中定义的一些扩展方法 - */ -@UseExperimental(ExperimentalContracts::class) -inline fun Contact.withBot(block: Bot.() -> R): R { - contract { - callsInPlace(block, InvocationKind.EXACTLY_ONCE) - } - return bot.run(block) -} +suspend inline fun Contact.sendMessage(plain: String) = sendMessage(plain.singleChain()) \ No newline at end of file