feat(config): 将代理类型为 null 的情况视为不使用代理.

为简化用户配置难度, 关闭代理可选择将 type 设为 null, 来表示不需要使用代理.
This commit is contained in:
LamGC 2022-05-19 15:46:18 +08:00
parent cac055bb08
commit 9aab3c2a24
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D

View File

@ -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.")
}