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

io.github.freya022.botcommands.api.components.builder.IConstrainableComponent.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 io.github.freya022.botcommands.api.ReceiverConsumer
import io.github.freya022.botcommands.api.components.data.InteractionConstraints
import net.dv8tion.jda.api.Permission
import net.dv8tion.jda.api.entities.Role
import net.dv8tion.jda.api.entities.UserSnowflake

/**
 * Allows components to have constraints
 *
 * @see InteractionConstraints
 */
interface IConstrainableComponent {
    var constraints: InteractionConstraints

    /** Adds user IDs to the constraints */
    fun addUserIds(vararg userIds: Long) = addUserIds(userIds.asList())
    /** Adds role IDs to the constraints */
    fun addRoleIds(vararg roleIds: Long) = addRoleIds(roleIds.asList())
    /** Adds permissions to the constraints */
    fun addPermissions(vararg permissions: Permission) = addPermissions(permissions.asList())

    /** Adds user IDs to the constraints */
    fun addUsers(vararg users: UserSnowflake) = addUsers(users.asList())
    /** Adds role IDs to the constraints */
    fun addRoles(vararg roles: Role) = addRoles(roles.asList())

    /** Adds user IDs to the constraints */
    fun addUsers(users: Collection)
    /** Adds role IDs to the constraints */
    fun addRoles(roles: Collection)

    /** Adds user IDs to the constraints */
    fun addUserIds(userIds: Collection)
    /** Adds role IDs to the constraints */
    fun addRoleIds(roleIds: Collection)
    /** Adds permissions to the constraints */
    fun addPermissions(permissions: Collection)

    /** Allows manipulating the [InteractionConstraints] instance */
    fun constraints(block: ReceiverConsumer)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy