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

Go to download

A Kotlin-first (and Java) framework that makes creating Discord bots a piece of cake, using the JDA library.

There is a newer version: 3.0.0-alpha.18
Show newest version
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 - 2024 Weber Informatics LLC | Privacy Policy