All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.freya022.botcommands.internal.commands.application.RequiresApplicationCommandsChecker.kt Maven / Gradle / Ivy

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}"
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy