BlockingBot

This commit is contained in:
Him188 2020-01-18 22:43:38 +08:00
parent 0163eea2f3
commit 4ef6f7e723
3 changed files with 3 additions and 8 deletions

View File

@ -1,6 +1,5 @@
package net.mamoe.mirai.japt;
import net.mamoe.mirai.Bot;
import net.mamoe.mirai.message.data.Message;
import net.mamoe.mirai.message.data.MessageChain;
import org.jetbrains.annotations.NotNull;
@ -11,7 +10,7 @@ public interface BlockingContact {
* 这个联系人所属 [Bot]
*/
@NotNull
Bot getBot();
BlockingBot getBot();
/**
* 可以是 QQ 号码或者群号码 [GroupId].

View File

@ -3,7 +3,6 @@
package net.mamoe.mirai.japt
import kotlinx.coroutines.runBlocking
import net.mamoe.mirai.Bot
import net.mamoe.mirai.contact.Group
import net.mamoe.mirai.contact.Member
import net.mamoe.mirai.contact.MemberPermission
@ -20,7 +19,7 @@ import net.mamoe.mirai.utils.MiraiInternalAPI
import net.mamoe.mirai.utils.toList
internal class BlockingQQImpl(private val delegate: QQ) : BlockingQQ {
override fun getBot(): Bot = delegate.bot
override fun getBot(): BlockingBot = delegate.bot.blocking()
override fun getId(): Long = delegate.id
override fun sendMessage(messages: MessageChain) = runBlocking { delegate.sendMessage(messages) }
override fun sendMessage(message: String) = runBlocking { delegate.sendMessage(message.toMessage().toChain()) }
@ -41,7 +40,7 @@ internal class BlockingGroupImpl(private val delegate: Group) : BlockingGroup {
override fun updateGroupInfo(): GroupInfo = runBlocking { delegate.updateGroupInfo() }
override fun toFullString(): String = delegate.toFullString()
override fun getMember(id: Long): BlockingMember = delegate.getMember(id).blocking()
override fun getBot(): Bot = delegate.bot
override fun getBot(): BlockingBot = delegate.bot.blocking()
override fun getAnnouncement(): String = delegate.announcement
@UseExperimental(MiraiInternalAPI::class)
override fun getMembers(): Map<Long, BlockingMember> =

View File

@ -32,9 +32,6 @@ dependencies {
api(project(":mirai-console"))
runtimeOnly(files("../mirai-core/build/classes/kotlin/jvm/main")) // classpath is not added correctly by IDE
implementation(group = 'com.alibaba', name = 'fastjson', version = '1.2.62')
implementation("org.jsoup:jsoup:1.12.1")
api(kotlin("stdlib", kotlinVersion))
api(kotlinx("io-jvm", kotlinXIoVersion))
api(kotlinx("io", kotlinXIoVersion))