
com.freya02.botcommands.api.commands.builder.CommandBuilder.kt Maven / Gradle / Ivy
package com.freya02.botcommands.api.commands.builder
import com.freya02.botcommands.api.commands.CommandPath
import com.freya02.botcommands.api.commands.CooldownScope
import com.freya02.botcommands.internal.commands.CommandDSL
import com.freya02.botcommands.internal.commands.CooldownStrategy
import com.freya02.botcommands.internal.commands.mixins.INamedCommand
import com.freya02.botcommands.internal.commands.mixins.INamedCommand.Companion.computePath
import com.freya02.botcommands.internal.enumSetOf
import net.dv8tion.jda.api.Permission
import java.util.*
import java.util.concurrent.TimeUnit
@CommandDSL
abstract class CommandBuilder internal constructor(override val name: String) : INamedCommand {
var userPermissions: EnumSet = enumSetOf()
var botPermissions: EnumSet = enumSetOf()
final override val path: CommandPath by lazy { computePath() }
@get:JvmSynthetic
internal var cooldownStrategy: CooldownStrategy = CooldownStrategy(0, TimeUnit.SECONDS, CooldownScope.USER)
private set
fun cooldown(block: CooldownStrategyBuilder.() -> Unit) {
cooldownStrategy = CooldownStrategyBuilder().apply(block).build()
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy