Package io.facet.chatcommands

Types

ChatCommand
Link copied to clipboard
abstract class ChatCommand(name: String, aliases: Set<String>, scope: Scope, category: String, description: String?, discordPermsRequired: PermissionSet, usage: CommandUsage?)
ChatCommandSource
Link copied to clipboard
class ChatCommandSource(event: MessageCreateEvent, command: String, prefixUsed: String, scope: CoroutineScope) : CoroutineScope

Command source for chat commands. Provides easy access to the message event objects.

CommandUsage
Link copied to clipboard
class CommandUsage(usageMap: Map<String, String>) : Iterable<CommandUsage.Pair>
CommandUsageBuilder
Link copied to clipboard
class CommandUsageBuilder
DSLCommandNode
Link copied to clipboard
interface DSLCommandNode<S>
Scope
Link copied to clipboard
enum Scope : Enum<Scope>
SuspendCommand
Link copied to clipboard
interface SuspendCommand<S> : Command<S>

Functions

commandUsage
Link copied to clipboard
fun commandUsage(block: CommandUsageBuilder.() -> Unit): CommandUsage

Note: this DSL is experimental and subject to change.

executesSuspend
Link copied to clipboard
fun <S, T : ArgumentBuilder<S, T>> ArgumentBuilder<S, T>.executesSuspend(command: suspend (context: CommandContext<S>) -> Unit): T
executeSuspend
Link copied to clipboard
suspend fun CommandDispatcher<ChatCommandSource>.executeSuspend(parseResults: ParseResults<ChatCommandSource>): Int
get
Link copied to clipboard
inline fun <T> CommandContext<ChatCommandSource>.get(name: String): T
getBool
Link copied to clipboard
fun CommandContext<ChatCommandSource>.getBool(name: String): Boolean
getChannels
Link copied to clipboard
fun CommandContext<ChatCommandSource>.getChannels(name: String): TextChannelSelector
getDouble
Link copied to clipboard
fun CommandContext<ChatCommandSource>.getDouble(name: String): Double
getFloat
Link copied to clipboard
fun CommandContext<ChatCommandSource>.getFloat(name: String): Float
getInt
Link copied to clipboard
fun CommandContext<ChatCommandSource>.getInt(name: String): Int
getLong
Link copied to clipboard
fun CommandContext<ChatCommandSource>.getLong(name: String): Long
getMembers
Link copied to clipboard
fun CommandContext<ChatCommandSource>.getMembers(name: String): MemberSelector
getRoles
Link copied to clipboard
fun CommandContext<ChatCommandSource>.getRoles(name: String): RoleSelector
getSnowflake
Link copied to clipboard
fun CommandContext<ChatCommandSource>.getSnowflake(name: String): Snowflake
getString
Link copied to clipboard
fun CommandContext<ChatCommandSource>.getString(name: String): String
literal
Link copied to clipboard
fun <T> CommandDispatcher<T>.literal(name: String, setup: DSLCommandNode<T>.() -> Unit): CommandNode<T>

adds an Literal (non argument/subcommand) node

plus
Link copied to clipboard
operator fun SuggestionsBuilder.plus(suggestion: Int): SuggestionsBuilder
operator fun SuggestionsBuilder.plus(suggestion: String): SuggestionsBuilder
requiresSuspend
Link copied to clipboard
fun <S, T : ArgumentBuilder<S, T>> ArgumentBuilder<S, T>.requiresSuspend(requirement: suspend (S) -> Boolean): T
respondEmbed
Link copied to clipboard
suspend fun ChatCommandSource.respondEmbed(spec: EmbedCreateSpec): Message

Sends an embed based on the EmbedCreateSpec in the channel that the command was invoked in.

suspend fun ChatCommandSource.respondEmbed(builder: EmbedBuilder.() -> Unit): Message

Builds an EmbedCreateSpec and sends it in the channel that the command was invoked in.

respondMessage
Link copied to clipboard
suspend fun ChatCommandSource.respondMessage(template: MessageCreateSpec): Message

Sends a message based on the MessageCreateSpec in the channel that the command was invoked in.

suspend fun ChatCommandSource.respondMessage(vararg specs: EmbedCreateSpec): Message

Sends an embed based on the EmbedCreateSpec in the channel that the command was invoked in.

suspend fun ChatCommandSource.respondMessage(builder: MessageBuilder.() -> Unit): Message

Builds a MessageCreateSpec and sends it in the channel that the command was invoked in.

suspend fun ChatCommandSource.respondMessage(content: String): Message

Builds a message spec with only content and sends it in the channel the command was invoked in.

runs
Link copied to clipboard
fun <T> DSLCommandNode<T>.runs(executed: suspend T.(context: CommandContext<T>) -> Unit)

Like executes but always return 0, so there is no need to return.

Properties

aliasUsed
Link copied to clipboard
val CommandContext<ChatCommandSource>.aliasUsed: String

Get the name of the command alias used.