discord-kagebot/src/main/kotlin/moe/kageru/kagebot/config/ConfigSpecs.kt
kageru d6492bae8f
Rewrite config to use Konf (4): Features
The entire config parsing is now rewritten. This entirely removes toml4j
in favor of Konf. It also removes all remaining RawConfig logic.
2019-10-18 22:03:57 +02:00

29 lines
965 B
Kotlin

package moe.kageru.kagebot.config
import com.uchuhimo.konf.ConfigSpec
import moe.kageru.kagebot.command.Command
import moe.kageru.kagebot.config.Config.system
import moe.kageru.kagebot.features.Features
import java.awt.Color
object SystemSpec : ConfigSpec() {
private val rawColor by optional("#1793d0", name = "color")
val serverId by required<String>()
val color by kotlin.lazy { Color.decode(system[rawColor])!! }
}
object LocalizationSpec : ConfigSpec() {
val permissionDenied by optional("You do not have the permission to use this command.")
val redirectedMessage by optional("says")
val messageDeleted by optional("Your message was deleted.")
val timeout by optional("You have been timed out for @@ minutes.")
}
object CommandSpec : ConfigSpec(prefix = "") {
val command by optional(emptyList<Command>())
}
object FeatureSpec : ConfigSpec(prefix = "") {
val features by optional(Features.DEFAULT, name = "feature")
}