refactor(config): 更改部分配置类的属性默认值.

为了保证扩展中命令的权限判断有效性, 故移除 BotAccount 中 creatorId 字段的默认值, 此改动将要求用户提供准确的 Bot 创建者 Id.
这个改动拖得越久, 影响的范围就越大.
另外, 为 BotConfig 中的 extensions 属性和 proxy 属性增加默认值, 以减少意义重复的情况(例如当用户没设置 proxy 属性时提供一个 type 为 NO_PROXY 的 ProxyConfig, 无需判断是否为 null).
This commit is contained in:
LamGC 2022-06-24 02:00:11 +08:00
parent a2667438f2
commit b12758bd18
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D

View File

@ -15,7 +15,7 @@ import java.net.URL
data class BotAccount(
val name: String,
val token: String,
val creatorId: Long = -1
val creatorId: Long
) {
val id
@ -43,8 +43,8 @@ data class BotConfig(
* 而构件坐标(POM Reference 或者叫 GAV 坐标)是开发者创建 Maven/Gradle 项目时一定会设置的,
* 所以就直接用了. :P
*/
val extensions: Set<Artifact>,
val proxy: ProxyConfig? = ProxyConfig(),
val extensions: Set<Artifact> = emptySet(),
val proxy: ProxyConfig = ProxyConfig(type = ProxyType.NO_PROXY),
val baseApiUrl: String? = ApiConstants.BASE_URL
)