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

com.freya02.botcommands.api.commands.prefixed.TextCommand Maven / Gradle / Ivy

package com.freya02.botcommands.api.commands.prefixed;

import com.freya02.botcommands.api.commands.CommandPath;
import com.freya02.botcommands.api.commands.annotations.GeneratedOption;
import com.freya02.botcommands.api.commands.application.slash.ApplicationGeneratedValueSupplier;
import com.freya02.botcommands.api.commands.prefixed.annotations.JDATextCommand;
import com.freya02.botcommands.api.parameters.ParameterType;
import net.dv8tion.jda.api.EmbedBuilder;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.function.Consumer;

/**
 * 

Extend this class on classes that contains any command / subcommand

*

You also need to use the {@linkplain JDATextCommand @JDATextCommand} annotation on methods in order to register a command

*/ public abstract class TextCommand { /** *

Returns a detailed embed of what the command is, it is used by the internal 'help' command

*

The 'help' command will automatically set the embed title to be "Command '[command_name]'" but can be overridden

*

It will also set the embed's description to be the command's description, you can override with {@link EmbedBuilder#setDescription(CharSequence)}

* * @return The EmbedBuilder to use as a detailed description */ @Nullable public Consumer getDetailedDescription() {return null;} /** * Returns the generated value supplier of an {@link GeneratedOption}, if the method doesn't return a generated value supplier, the framework will throw. *
This method is called only if your option is annotated with {@link GeneratedOption} * *

This method will only be called once per command option per guild * * @param commandPath The path of the command, as set in {@link JDATextCommand} * @param optionName The name of the transformed command option, might not be equal to the parameter name * @param parameterType The boxed type of the command option * * @return A {@link ApplicationGeneratedValueSupplier} to generate the option on command execution */ @NotNull public TextGeneratedValueSupplier getGeneratedValueSupplier(@NotNull CommandPath commandPath, @NotNull String optionName, @NotNull ParameterType parameterType) { throw new IllegalArgumentException("Option '%s' in command path '%s' is a generated option but no generated value supplier has been given".formatted(optionName, commandPath.getFullPath())); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy