discord-kagebot/src/main/kotlin/moe/kageru/kagebot/features/Features.kt
2019-07-11 20:14:22 +02:00

20 lines
613 B
Kotlin

package moe.kageru.kagebot.features
import moe.kageru.kagebot.config.RawFeatures
class Features(val welcome: WelcomeFeature?, val debug: DebugFeature?, val help: HelpFeature?) {
constructor(rawFeatures: RawFeatures) : this(
rawFeatures.welcome?.let(::WelcomeFeature),
rawFeatures.debug?.let(::DebugFeature),
rawFeatures.help?.let(::HelpFeature)
)
fun all() = listOfNotNull(this.welcome, this.debug, this.help)
fun allWithMessage() = all().filterIsInstance<MessageFeature>()
companion object {
val NONE = Features(null, null, null)
}
}
interface Feature