mirror of
https://github.com/LamGC/ScalaBot.git
synced 2025-04-29 22:27:31 +00:00
feat(config): 将代理类型为 null 的情况视为不使用代理.
为简化用户配置难度, 关闭代理可选择将 type 设为 null, 来表示不需要使用代理.
This commit is contained in:
parent
cac055bb08
commit
9aab3c2a24
@ -20,6 +20,9 @@ internal object ProxyTypeSerializer : JsonDeserializer<DefaultBotOptions.ProxyTy
|
||||
typeOfT: Type?,
|
||||
context: JsonDeserializationContext?
|
||||
): DefaultBotOptions.ProxyType {
|
||||
if (json.isJsonNull) {
|
||||
return DefaultBotOptions.ProxyType.NO_PROXY
|
||||
}
|
||||
if (!json.isJsonPrimitive) {
|
||||
throw JsonParseException("Wrong configuration value type.")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user