io.github.freya022.botcommands.api.components.builder.IConstrainableComponent.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of BotCommands Show documentation
Show all versions of BotCommands Show documentation
A Kotlin-first (and Java) framework that makes creating Discord bots a piece of cake, using the JDA library.
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)
}