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

fr.alexpado.jda.interactions.annotations.Option Maven / Gradle / Ivy

package fr.alexpado.jda.interactions.annotations;

import net.dv8tion.jda.api.entities.*;
import net.dv8tion.jda.api.interactions.commands.OptionType;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Annotation allowing to list all options available for an {@link Interact}.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({})
public @interface Option {

    /**
     * The name of the option. In a slash context, this will be shown as command parameter.
     *
     * @return The option's name.
     */
    String name();

    /**
     * The description of the option. In a Slash context, this will be shown as a command parameter description.
     *
     * @return The option's description.
     */
    String description();

    /**
     * List of {@link Choice} available for this option.
     *
     * @return The option's choices.
     */
    Choice[] choices() default {};

    /**
     * Define if this option is required for the interaction to be executed. In a Slash context, the verification is
     * done by Discord.
     *
     * @return True if the option is required, false otherwise.
     */
    boolean required() default false;

    /**
     * Define if this option can be auto-completed.
     *
     * @return True if auto-completable, false otherwise.
     */
    boolean autoComplete() default false;

    /**
     * The type of the option. This will affect this option auto-complete behaviour in the Discord client.
     *
     * 
    *
  • {@link OptionType#STRING}: Allow the user to type any text. (Parameter type is {@link String})
  • *
  • {@link OptionType#INTEGER}: Allow the user to type any number. (Parameter type is {@link Long})
  • *
  • {@link OptionType#BOOLEAN}: Allow the user to type only in a yes/no fashion. (Parameter type is {@link Boolean})
  • *
  • {@link OptionType#USER}: Allow the user to select another user. (Parameter type is {@link Member})
  • *
  • {@link OptionType#CHANNEL}: Allow the user to select a channel. On the client, this include both {@link VoiceChannel}, {@link TextChannel} and {@link Category}. (Parameter type is {@link GuildChannel})
  • *
  • {@link OptionType#ROLE}: Allow the user to select a role. (Parameter type is {@link Role})
  • *
  • {@link OptionType#MENTIONABLE}: Allow the user to select anything that can be mentioned. (Parameter type is {@link IMentionable})
  • *
  • {@link OptionType#ATTACHMENT}: Allow the user to attach a file to the interaction. (Parameter type is {@link Message.Attachment})
  • *
* * @return The option's type. */ OptionType type(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy