2019-06-12 23:43:36 +02:00
package moe.kageru.kagebot.config
2019-11-11 19:09:58 +01:00
import arrow.core.ListK
import arrow.core.k
2019-10-06 16:14:01 +02:00
import com.uchuhimo.konf.Config
import com.uchuhimo.konf.source.toml
2019-06-12 23:43:36 +02:00
import moe.kageru.kagebot.command.Command
import moe.kageru.kagebot.features.Features
2019-07-13 15:39:50 +02:00
import org.javacord.api.entity.server.Server
object Config {
2019-10-18 19:34:41 +02:00
val systemSpec = Config { addSpec ( SystemSpec ) } . from . toml
val localeSpec = Config { addSpec ( LocalizationSpec ) } . from . toml
2019-10-18 20:48:43 +02:00
val commandSpec = Config { addSpec ( CommandSpec ) } . from . toml
2019-10-18 21:56:31 +02:00
val featureSpec = Config { addSpec ( FeatureSpec ) } . from . toml
2019-10-18 19:34:41 +02:00
lateinit var system : Config
lateinit var localization : Config
2019-10-18 20:48:43 +02:00
lateinit var commandConfig : Config
2019-10-18 21:56:31 +02:00
lateinit var featureConfig : Config
lateinit var server : Server
2019-10-18 20:48:43 +02:00
// for easier access
2019-10-18 21:56:31 +02:00
val features : Features get ( ) = featureConfig [ FeatureSpec . features ]
2019-11-11 19:09:58 +01:00
val commands : ListK < Command > get ( ) = commandConfig [ CommandSpec . command ] . k ( )
2019-06-14 21:23:17 +02:00
}