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

io.github.freya022.botcommands.api.commands.annotations.VarArgs.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.annotations

import io.github.freya022.botcommands.api.commands.application.slash.annotations.MentionsString
import io.github.freya022.botcommands.api.commands.application.slash.annotations.SlashOption
import io.github.freya022.botcommands.api.commands.application.slash.builder.SlashCommandBuilder
import io.github.freya022.botcommands.api.commands.application.slash.options.builder.inlineClassOptionVararg
import io.github.freya022.botcommands.api.commands.text.annotations.TextOption
import io.github.freya022.botcommands.api.commands.text.builder.TextCommandVariationBuilder
import io.github.freya022.botcommands.api.commands.text.options.builder.inlineClassOptionVararg

/**
 * Generates N command options from the specified [@SlashOption][SlashOption] or [@TextOption][TextOption].
 *
 * The target parameter must be of type [List].
 *
 * You can configure how many arguments are required with [numRequired].
 *
 * See [@MentionsString][MentionsString] for a way to get a list of mentionable (user/member/role/channel...)
 * without a vararg, using a single string.
 *
 * **Note:** You are limited to one vararg parameter in text commands.
 *
 * @see TextCommandVariationBuilder.optionVararg
 * @see TextCommandVariationBuilder.inlineClassOptionVararg
 *
 * @see SlashCommandBuilder.optionVararg
 * @see SlashCommandBuilder.inlineClassOptionVararg
 *
 * @see MentionsString @MentionsString
 */
@Target(AnnotationTarget.VALUE_PARAMETER)
@Retention(AnnotationRetention.RUNTIME)
annotation class VarArgs(
    /**
     * The number of times this option needs to appear, which must be between 1 and {@value CommandData#MAX_OPTIONS}.
     */
    val value: Int,

    /**
     * The number of required options for this vararg.
     */
    val numRequired: Int = 1
)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy