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

io.github.freya022.botcommands.api.commands.text.IHelpCommand.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.api.commands.text

import io.github.freya022.botcommands.api.core.service.annotations.BService
import io.github.freya022.botcommands.api.core.service.annotations.InterfacedService

/**
 * Must be implemented by your custom help command.
 *
 * If an implementation of that interface is found, it replaces the built-in help command.
 *
 * This lets the framework use the command to also display help about specific commands.
 *
 * **Usage**: Register your instance as a service with [@BService][BService].
 *
 * @see InterfacedService @InterfacedService
 */
@InterfacedService(acceptMultiple = false)
interface IHelpCommand {
    /**
     * Fired when a command is recognized, but the arguments do not correspond to any command variation.
     *
     * @param event       The event of the current command invocation
     * @param commandInfo The command info of the command which the user tried to use
     */
    fun onInvalidCommand(event: BaseCommandEvent, commandInfo: TextCommandInfo): Unit =
        throw NotImplementedError("${this.javaClass.simpleName} must implement the 'onInvalidCommand' or 'onInvalidCommandSuspend' method")

    /**
     * Fired when a command is recognized, but the arguments do not correspond to any command variation.
     *
     * @param event       The event of the current command invocation
     * @param commandInfo The command info of the command which the user tried to use
     */
    @JvmSynthetic
    suspend fun onInvalidCommandSuspend(event: BaseCommandEvent, commandInfo: TextCommandInfo): Unit =
        onInvalidCommand(event, commandInfo)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy