discord-kagebot/src/main/kotlin/moe/kageru/kagebot/features/Features.kt
kageru b0d3475469
Add getConfig feature to retrieve the current config file
This implements #11 and is preparation for config reloading at runtime
2019-07-14 17:14:23 +02:00

27 lines
618 B
Kotlin

package moe.kageru.kagebot.features
import moe.kageru.kagebot.config.RawFeatures
class Features(
val welcome: WelcomeFeature?,
debug: DebugFeature,
help: HelpFeature,
getConfig: GetConfigFeature
) {
constructor(rawFeatures: RawFeatures) : this(
rawFeatures.welcome?.let(::WelcomeFeature),
DebugFeature(),
HelpFeature(),
GetConfigFeature()
)
private val featureMap = mapOf(
"help" to help,
"debug" to debug,
"welcome" to welcome,
"getConfig" to getConfig
)
fun findByString(feature: String) = featureMap[feature]
}