From f27e42d225f8593529796b7ada2012e3460e8a43 Mon Sep 17 00:00:00 2001 From: Him188 Date: Sun, 7 Feb 2021 13:12:40 +0800 Subject: [PATCH] Fix BotConfiguration.copy --- .../src/commonMain/kotlin/utils/BotConfiguration.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mirai-core-api/src/commonMain/kotlin/utils/BotConfiguration.kt b/mirai-core-api/src/commonMain/kotlin/utils/BotConfiguration.kt index 6cbd25d17..79346c6bc 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/BotConfiguration.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/BotConfiguration.kt @@ -455,17 +455,24 @@ public open class BotConfiguration { // open for Java public fun copy(): BotConfiguration { return BotConfiguration().also { new -> - new.botLoggerSupplier = botLoggerSupplier - new.networkLoggerSupplier = networkLoggerSupplier - new.deviceInfo = deviceInfo + // To structural order + new.workingDir = workingDir + new.json = json new.parentCoroutineContext = parentCoroutineContext new.heartbeatPeriodMillis = heartbeatPeriodMillis new.heartbeatTimeoutMillis = heartbeatTimeoutMillis new.firstReconnectDelayMillis = firstReconnectDelayMillis new.reconnectPeriodMillis = reconnectPeriodMillis new.reconnectionRetryTimes = reconnectionRetryTimes + new.autoReconnectOnForceOffline = autoReconnectOnForceOffline new.loginSolver = loginSolver new.protocol = protocol + new.highwayUploadCoroutineCount = highwayUploadCoroutineCount + new.deviceInfo = deviceInfo + new.botLoggerSupplier = botLoggerSupplier + new.networkLoggerSupplier = networkLoggerSupplier + new.friendListCache = friendListCache + new.groupMemberListCache = groupMemberListCache } }