mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-05 23:50:08 +08:00
Inline NetworkHandler.isOk
This commit is contained in:
parent
394f45fa9e
commit
c19265b954
@ -23,6 +23,7 @@ import net.mamoe.mirai.internal.contact.uin
|
||||
import net.mamoe.mirai.internal.network.component.ComponentStorage
|
||||
import net.mamoe.mirai.internal.network.components.SsoProcessor
|
||||
import net.mamoe.mirai.internal.network.handler.NetworkHandler
|
||||
import net.mamoe.mirai.internal.network.handler.NetworkHandler.State
|
||||
import net.mamoe.mirai.internal.network.handler.selector.NetworkException
|
||||
import net.mamoe.mirai.internal.network.impl.netty.asCoroutineExceptionHandler
|
||||
import net.mamoe.mirai.network.LoginFailedException
|
||||
@ -85,7 +86,7 @@ internal abstract class AbstractBot constructor(
|
||||
*/
|
||||
abstract val components: ComponentStorage
|
||||
|
||||
final override val isOnline: Boolean get() = network.isOk()
|
||||
final override val isOnline: Boolean get() = network.state == State.OK
|
||||
final override val eventChannel: EventChannel<BotEvent> =
|
||||
GlobalEventChannel.filterIsInstance<BotEvent>().filter { it.bot === this@AbstractBot }
|
||||
|
||||
|
@ -38,8 +38,6 @@ import net.mamoe.mirai.utils.MiraiLogger
|
||||
internal interface NetworkHandler : CoroutineScope {
|
||||
val context: NetworkHandlerContext
|
||||
|
||||
fun isOk() = state == State.OK
|
||||
|
||||
/**
|
||||
* Current state of this handler. This is volatile.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user