discord-kagebot/src/main/kotlin/moe/kageru/kagebot/features/Features.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

26 lines
785 B
Kotlin

package moe.kageru.kagebot.features
class Features(val welcome: WelcomeFeature?, val timeout: TimeoutFeature?) {
private val debug = DebugFeature()
private val help = HelpFeature()
private val getConfig = GetConfigFeature()
private val setConfig = SetConfigFeature()
private val all = listOf(welcome, debug, help, getConfig, setConfig, timeout)
private val featureMap = mapOf(
"help" to help,
"debug" to debug,
"welcome" to welcome,
"getConfig" to getConfig,
"setConfig" to setConfig,
"timeout" to timeout
)
fun findByString(feature: String) = featureMap[feature]
fun eventFeatures() = all.filterIsInstance<EventFeature>()
companion object {
val DEFAULT = Features(null, null)
}
}