io.github.freya022.botcommands.internal.commands.application.RequiresApplicationCommandsChecker.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of BotCommands Show documentation
Show all versions of BotCommands Show documentation
A Kotlin-first (and Java) framework that makes creating Discord bots a piece of cake, using the JDA library.
package io.github.freya022.botcommands.internal.commands.application
import io.github.freya022.botcommands.api.commands.application.annotations.RequiresApplicationCommands
import io.github.freya022.botcommands.api.core.config.BApplicationConfig
import io.github.freya022.botcommands.api.core.service.CustomConditionChecker
import io.github.freya022.botcommands.api.core.service.ServiceContainer
import io.github.freya022.botcommands.api.core.service.getService
import io.github.freya022.botcommands.internal.utils.reference
internal object RequiresApplicationCommandsChecker : CustomConditionChecker {
override val annotationType: Class = RequiresApplicationCommands::class.java
override fun checkServiceAvailability(
serviceContainer: ServiceContainer,
checkedClass: Class<*>,
annotation: RequiresApplicationCommands
): String? {
if (serviceContainer.getService().enable) {
return null
}
return "Application commands needs to be enabled, see ${BApplicationConfig::enable.reference}"
}
}