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

io.github.freya022.botcommands.api.components.builder.IUniqueComponent.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.components.builder

import javax.annotation.CheckReturnValue

/**
 * Allows components to be used once before being deleted
 *
 * ### Component deletion
 * - If the component is a group, then all of its owned components will also be deleted.
 * - If the component is inside a group, then all the group's components will also be deleted.
 *
 * This will also cause cancellation of any associated timeout.
 */
interface IUniqueComponent> {
    /**
     * Sets this component as being usable once.
     *
     * ### Component deletion
     * - If the component is a group, then all of its owned components will also be deleted.
     * - If the component is inside a group, then all the group's components will also be deleted.
     *
     * This will also cause cancellation of any associated timeout.
     */
    @Deprecated(message = "Renamed to 'singleUse'", ReplaceWith("singleUse"))
    var oneUse: Boolean
        get() = singleUse
        set(value) {
            singleUse = value
        }

    /**
     * Sets this component as being usable once.
     *
     * ### Component deletion
     * - If the component is a group, then all of its owned components will also be deleted.
     * - If the component is inside a group, then all the group's components will also be deleted.
     *
     * This will also cause cancellation of any associated timeout.
     */
    var singleUse: Boolean

    /**
     * Sets this component as being usable once.
     *
     * ### Component deletion
     * - If the component is a group, then all of its owned components will also be deleted.
     * - If the component is inside a group, then all the group's components will also be deleted.
     *
     * This will also cause cancellation of any associated timeout.
     */
    @Deprecated(message = "Renamed to 'singleUse'", ReplaceWith("singleUse(oneUse)"))
    @CheckReturnValue
    fun oneUse(oneUse: Boolean): T = singleUse(oneUse)

    /**
     * Sets this component as being usable once.
     *
     * ### Component deletion
     * - If the component is a group, then all of its owned components will also be deleted.
     * - If the component is inside a group, then all the group's components will also be deleted.
     *
     * This will also cause cancellation of any associated timeout.
     */
    @CheckReturnValue
    fun singleUse(singleUse: Boolean): T
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy