Commit 5ca07d37 authored by Him188's avatar Him188

Add instance getters

parent d71bac77
......@@ -169,8 +169,11 @@ class Bot(val account: BotAccount, val logger: MiraiLogger) : CoroutineScope {
private val _instances: MutableList<Bot> = mutableListOf()
private val instanceLock: Mutex = Mutex()
val instances: List<Bot> get() = _instances
private val instances: List<Bot> get() = _instances
suspend fun instanceWhose(qq: UInt) = instanceLock.withLock {
instances.first { it.qqAccount == qq }
}
internal suspend fun addInstance(bot: Bot) = instanceLock.withLock {
_instances += bot
......
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