diff --git a/mirai-core/src/commonMain/kotlin/AbstractBot.kt b/mirai-core/src/commonMain/kotlin/AbstractBot.kt index 76ef805d2..87bca008b 100644 --- a/mirai-core/src/commonMain/kotlin/AbstractBot.kt +++ b/mirai-core/src/commonMain/kotlin/AbstractBot.kt @@ -135,8 +135,10 @@ internal abstract class AbstractBot( @Volatile var networkInitialized = false val network: NetworkHandler by lazy { - networkInitialized = true - createNetworkHandler() + createNetworkHandler().also { + it.context // ensure components available + networkInitialized = true + } } // the selector handles renewal of [NetworkHandler] final override suspend fun login() {