Old network: delete account secrets on BotOfflineEvent.Force. #1205 for 2.7-M1

This commit is contained in:
Him188 2021-04-30 22:46:36 +08:00
parent 57eb716e31
commit 84d444843d
2 changed files with 2 additions and 2 deletions

View File

@ -17,7 +17,6 @@
package net.mamoe.mirai.internal
import io.ktor.util.*
import kotlinx.coroutines.*
import kotlinx.coroutines.sync.Mutex
import net.mamoe.mirai.Bot
@ -129,6 +128,7 @@ internal abstract class AbstractBot<N : BotNetworkHandler> constructor(
}
is BotOfflineEvent.Force -> {
bot.logger.info { "Connection occupied by another android device: ${event.message}" }
bot.asQQAndroidBot().accountSecretsFile.delete()
if (event.reconnect) {
bot.logger.info { "Reconnecting..." }
// delay(3000)

View File

@ -72,7 +72,7 @@ internal class QQAndroidBot constructor(
private val cacheDir: File by lazy {
configuration.workingDir.resolve(bot.configuration.cacheDir).apply { mkdirs() }
}
private val accountSecretsFile: File by lazy {
internal val accountSecretsFile: File by lazy {
cacheDir.resolve("account.secrets")
}