Package-level declarations

Command builders, events, and functions.

Types

Link copied to clipboard
sealed interface Command
Link copied to clipboard
open class CommandEvent<T : TypeContainer>(val rawInputs: RawInputs, val discord: Discord, val message: Message?, val author: User, val channel: MessageChannel, val guild: Guild?) : Responder

A generic command execution event.

Link copied to clipboard
class CommandSet(category: String, requiredPermissionLevel: Permissions?, collector: CommandSetBuilder.() -> Unit) : BuilderRegister

This is not for you...

Link copied to clipboard
data class CommandSetBuilder(val discord: Discord, val category: String, requiredPermissions: Permissions)

DSL used to build a set of commands.

Link copied to clipboard
class ContextCommand(val name: String, val displayText: String, val description: String, val category: String, val requiredPermissions: Permissions, val executions: MutableList<Execution<CommandEvent<*>>> = mutableListOf()) : GuildSlashCommand

A command that can be executed via the context menu.

Link copied to clipboard
data class ContextEvent<T>(val rawInputs: RawInputs, val discord: Discord, val message: Message?, val author: User, val channel: MessageChannel, val guild: Guild, val interaction: GuildApplicationCommandInteraction?, val arg: T) : SlashCommandEvent<Args1<T>> , SlashResponder

An event fired by a contextual slash command.

Link copied to clipboard
open class DiscordContext(val discord: Discord, val message: Message?, val author: User, val channel: MessageChannelBehavior, val guild: Guild?) : Responder

The discord context of the command execution.

Link copied to clipboard
data class DmCommandEvent<T : TypeContainer>(val rawInputs: RawInputs, val discord: Discord, val message: Message, val author: User, val channel: DmChannel, val guild: Guild? = null) : CommandEvent<T>

An event that can only be fired in a DM.

Link copied to clipboard
class DmTextCommand(val names: List<String>, var description: String = "", val category: String, var requiredPermissions: Permissions, val executions: MutableList<Execution<CommandEvent<*>>> = mutableListOf()) : TextCommand

A text command that can only be executed in a DM.

Link copied to clipboard
data class Execution<T : CommandEvent<*>>(val arguments: List<Argument<*, *>>, val action: suspend T.() -> Unit)

The bundle of information to be executed when a command is invoked.

Link copied to clipboard
class GlobalSlashCommand(val name: String, val description: String, val category: String, val requiredPermissions: Permissions, val executions: MutableList<Execution<CommandEvent<*>>> = mutableListOf()) : SlashCommand

A slash command that can be executed anywhere.

Link copied to clipboard
class GlobalTextCommand(val names: List<String>, var description: String = "", val category: String, var requiredPermissions: Permissions, val executions: MutableList<Execution<CommandEvent<*>>> = mutableListOf()) : TextCommand

A text command that can be executed from anywhere.

Link copied to clipboard
data class GuildCommandEvent<T : TypeContainer>(val rawInputs: RawInputs, val discord: Discord, val message: Message, val author: User, val channel: GuildMessageChannel, val guild: Guild) : CommandEvent<T>

An event that can only be fired in a guild.

Link copied to clipboard
open class GuildSlashCommand(val name: String, val description: String, val category: String, val requiredPermissions: Permissions, val executions: MutableList<Execution<CommandEvent<*>>> = mutableListOf()) : SlashCommand

A slash command that can be executed in a guild.

Link copied to clipboard
data class GuildSlashCommandEvent<T : TypeContainer>(val rawInputs: RawInputs, val discord: Discord, val message: Message?, val author: User, val channel: MessageChannel, val guild: Guild, val interaction: GuildApplicationCommandInteraction?) : SlashCommandEvent<T> , SlashResponder

An event fired by a guild slash command.

Link copied to clipboard
class GuildTextCommand(val names: List<String>, var description: String = "", val category: String, var requiredPermissions: Permissions, val executions: MutableList<Execution<CommandEvent<*>>> = mutableListOf()) : TextCommand

A text command that can only be executed in a guild.

Link copied to clipboard
data class RawInputs(val rawMessageContent: String, val commandName: String, val prefixCount: Int, val commandArgs: List<String> = rawMessageContent.split(" ").drop(1))

Data class containing the raw information from the command execution.

Link copied to clipboard
sealed interface SlashCommand : Command

Abstract slash command representation.

Link copied to clipboard
open class SlashCommandEvent<T : TypeContainer>(val rawInputs: RawInputs, val discord: Discord, val message: Message?, val author: User, val channel: MessageChannel, val guild: Guild? = null, val interaction: ApplicationCommandInteraction?) : CommandEvent<T> , SlashResponder

An event fired by a slash command.

Link copied to clipboard
class SubCommandSet(name: String, requiredPermissionLevel: Permissions?, collector: SubCommandSetBuilder.() -> Unit) : BuilderRegister

This is not for you...

Link copied to clipboard
data class SubCommandSetBuilder(val discord: Discord, val category: String, requiredPermissions: Permissions)

DSL used to build a set of commands.

Link copied to clipboard
sealed interface TextCommand : Command

Abstract text command representation.

Functions

Link copied to clipboard
fun commands(category: String, requiredPermissionLevel: Permissions? = null, construct: CommandSetBuilder.() -> Unit): CommandSet

Create a block for registering commands.

Link copied to clipboard
fun <T : Command> List<T>.findByName(name: String): T?

Find a command by its name (case-insensitive).

Link copied to clipboard
fun subcommand(name: String, requiredPermissionLevel: Permissions? = null, construct: SubCommandSetBuilder.() -> Unit): SubCommandSet

Create a block for registering commands.