mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-08 17:20:11 +08:00
BlockingBot
This commit is contained in:
parent
0163eea2f3
commit
4ef6f7e723
@ -1,6 +1,5 @@
|
|||||||
package net.mamoe.mirai.japt;
|
package net.mamoe.mirai.japt;
|
||||||
|
|
||||||
import net.mamoe.mirai.Bot;
|
|
||||||
import net.mamoe.mirai.message.data.Message;
|
import net.mamoe.mirai.message.data.Message;
|
||||||
import net.mamoe.mirai.message.data.MessageChain;
|
import net.mamoe.mirai.message.data.MessageChain;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -11,7 +10,7 @@ public interface BlockingContact {
|
|||||||
* 这个联系人所属 [Bot]
|
* 这个联系人所属 [Bot]
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
Bot getBot();
|
BlockingBot getBot();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 可以是 QQ 号码或者群号码 [GroupId].
|
* 可以是 QQ 号码或者群号码 [GroupId].
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
package net.mamoe.mirai.japt
|
package net.mamoe.mirai.japt
|
||||||
|
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import net.mamoe.mirai.Bot
|
|
||||||
import net.mamoe.mirai.contact.Group
|
import net.mamoe.mirai.contact.Group
|
||||||
import net.mamoe.mirai.contact.Member
|
import net.mamoe.mirai.contact.Member
|
||||||
import net.mamoe.mirai.contact.MemberPermission
|
import net.mamoe.mirai.contact.MemberPermission
|
||||||
@ -20,7 +19,7 @@ import net.mamoe.mirai.utils.MiraiInternalAPI
|
|||||||
import net.mamoe.mirai.utils.toList
|
import net.mamoe.mirai.utils.toList
|
||||||
|
|
||||||
internal class BlockingQQImpl(private val delegate: QQ) : BlockingQQ {
|
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 getId(): Long = delegate.id
|
||||||
override fun sendMessage(messages: MessageChain) = runBlocking { delegate.sendMessage(messages) }
|
override fun sendMessage(messages: MessageChain) = runBlocking { delegate.sendMessage(messages) }
|
||||||
override fun sendMessage(message: String) = runBlocking { delegate.sendMessage(message.toMessage().toChain()) }
|
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 updateGroupInfo(): GroupInfo = runBlocking { delegate.updateGroupInfo() }
|
||||||
override fun toFullString(): String = delegate.toFullString()
|
override fun toFullString(): String = delegate.toFullString()
|
||||||
override fun getMember(id: Long): BlockingMember = delegate.getMember(id).blocking()
|
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
|
override fun getAnnouncement(): String = delegate.announcement
|
||||||
@UseExperimental(MiraiInternalAPI::class)
|
@UseExperimental(MiraiInternalAPI::class)
|
||||||
override fun getMembers(): Map<Long, BlockingMember> =
|
override fun getMembers(): Map<Long, BlockingMember> =
|
||||||
|
@ -32,9 +32,6 @@ dependencies {
|
|||||||
api(project(":mirai-console"))
|
api(project(":mirai-console"))
|
||||||
runtimeOnly(files("../mirai-core/build/classes/kotlin/jvm/main")) // classpath is not added correctly by IDE
|
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(kotlin("stdlib", kotlinVersion))
|
||||||
api(kotlinx("io-jvm", kotlinXIoVersion))
|
api(kotlinx("io-jvm", kotlinXIoVersion))
|
||||||
api(kotlinx("io", kotlinXIoVersion))
|
api(kotlinx("io", kotlinXIoVersion))
|
||||||
|
Loading…
Reference in New Issue
Block a user