diff --git a/scalabot-app/src/main/kotlin/AppMain.kt b/scalabot-app/src/main/kotlin/AppMain.kt index e5ba519..7146390 100644 --- a/scalabot-app/src/main/kotlin/AppMain.kt +++ b/scalabot-app/src/main/kotlin/AppMain.kt @@ -140,7 +140,7 @@ internal class Launcher(private val config: AppConfig = Const.config) : AutoClos log.info { "正在启动机器人 `${botConfig.account.name}`..." } val botOption = DefaultBotOptions().apply { val proxyConfig = - if (botConfig.proxy != null && botConfig.proxy!!.type != ProxyType.NO_PROXY) { + if (botConfig.proxy.type != ProxyType.NO_PROXY) { botConfig.proxy } else if (config.proxy.type != ProxyType.NO_PROXY) { config.proxy @@ -154,9 +154,7 @@ internal class Launcher(private val config: AppConfig = Const.config) : AutoClos log.debug { "机器人 `${botConfig.account.name}` 已启用代理配置: $proxyConfig" } } - if (botConfig.baseApiUrl != null) { - baseUrl = botConfig.baseApiUrl - } + baseUrl = botConfig.baseApiUrl } val account = botConfig.account diff --git a/scalabot-meta/src/main/kotlin/Configs.kt b/scalabot-meta/src/main/kotlin/Configs.kt index 28d02d4..60a335d 100644 --- a/scalabot-meta/src/main/kotlin/Configs.kt +++ b/scalabot-meta/src/main/kotlin/Configs.kt @@ -45,7 +45,7 @@ data class BotConfig( */ val extensions: Set = emptySet(), val proxy: ProxyConfig = ProxyConfig(type = ProxyType.NO_PROXY), - val baseApiUrl: String? = ApiConstants.BASE_URL + val baseApiUrl: String = ApiConstants.BASE_URL ) enum class ProxyType {