DefaultApplicationCommandRegistry

Registry for all Discord application commands.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Command parser to use for slash commands.

Link copied to clipboard
open val bot: ExtensibleBot

Current instance of the bot.

Link copied to clipboard

Whether the initial sync has been finished, and commands should be registered directly.

Link copied to clipboard
open val kord: Kord

Kord instance, backing the ExtensibleBot.

Link copied to clipboard
open val messageCommands: MutableMap<Snowflake, MessageCommand<*, *>>

Mapping of Discord-side command ID to a message command object.

Link copied to clipboard
val ApplicationCommandType.name: String

Quick access to the human-readable name for a Discord application command type.

Link copied to clipboard
open val slashCommands: MutableMap<Snowflake, SlashCommand<*, *, *>>

Mapping of Discord-side command ID to a slash command object.

Link copied to clipboard
open val userCommands: MutableMap<Snowflake, UserCommand<*, *>>

Mapping of Discord-side command ID to a user command object.

Functions

Link copied to clipboard
open suspend fun createDiscordCommand(command: ApplicationCommand<*>): Snowflake?

Creates a KordEx ApplicationCommand as discord command and returns the created command's id as Snowflake.

Link copied to clipboard
open suspend fun createDiscordMessageCommand(command: MessageCommand<*, *>): Snowflake?

Creates a KordEx MessageCommand as discord command and returns the created command's id as Snowflake.

Link copied to clipboard
open suspend fun createDiscordSlashCommand(command: SlashCommand<*, *, *>): Snowflake?

Creates a KordEx SlashCommand as discord command and returns the created command's id as Snowflake.

Link copied to clipboard
open suspend fun createDiscordUserCommand(command: UserCommand<*, *>): Snowflake?

Creates a KordEx UserCommand as discord command and returns the created command's id as Snowflake.

Link copied to clipboard
open override fun getKoin(): Koin

Get the associated Koin instance.

Link copied to clipboard
open suspend override fun handle(event: AutoCompleteInteractionCreateEvent)

Event handler for autocomplete interactions.

open suspend override fun handle(event: ChatInputCommandInteractionCreateEvent)

Event handler for slash commands.

open suspend override fun handle(event: MessageCommandInteractionCreateEvent)

Event handler for message commands.

open suspend override fun handle(event: UserCommandInteractionCreateEvent)

Event handler for user commands.

Link copied to clipboard
open suspend override fun initialize(commands: List<ApplicationCommand<*>>)

Called once the initial registration started and all extensions are loaded.

Link copied to clipboard
suspend fun initialRegistration()

Handles the initial registration of commands, after extensions have been loaded.

Link copied to clipboard
open fun ApplicationCommand<*>.matches(locale: Locale, other: ApplicationCommand): Boolean

Check whether the type and name of an extension-registered application command matches a Discord one.

Link copied to clipboard
open suspend fun ChatInputCreateBuilder.register(locale: Locale, command: SlashCommand<*, *, *>)

Registration logic for slash commands, extracted for clarity.

open fun GlobalMessageCommandCreateBuilder.register(locale: Locale, command: MessageCommand<*, *>)
open fun MessageCommandCreateBuilder.register(locale: Locale, command: MessageCommand<*, *>)

Registration logic for message commands, extracted for clarity.

open fun GlobalUserCommandCreateBuilder.register(locale: Locale, command: UserCommand<*, *>)
open fun UserCommandCreateBuilder.register(locale: Locale, command: UserCommand<*, *>)

Registration logic for user commands, extracted for clarity.

open suspend override fun register(command: MessageCommand<*, *>): MessageCommand<*, *>?

Register a message command.

open suspend override fun register(command: SlashCommand<*, *, *>): SlashCommand<*, *, *>?

Register a slash command.

open suspend override fun register(command: UserCommand<*, *>): UserCommand<*, *>?

Register a user command.

Link copied to clipboard
open suspend fun <T : ApplicationCommand<*>> registerAll(vararg commands: T): List<T>

Register multiple slash commands.

Link copied to clipboard
open fun GlobalApplicationCommandCreateBuilder.registerGlobalPermissions(locale: Locale, command: ApplicationCommand<*>)

Registers the global permissions of command.

Link copied to clipboard
open fun ApplicationCommandCreateBuilder.registerGuildPermissions(locale: Locale, command: ApplicationCommand<*>)

Registers the guild permission of command.

Link copied to clipboard
open suspend fun sync(removeOthers: Boolean = false, guildId: Snowflake?, commands: List<ApplicationCommand<*>>)

Register multiple generic application commands.

Link copied to clipboard
open suspend fun syncAll(removeOthers: Boolean = false, commands: List<ApplicationCommand<*>>)

Register multiple generic application commands.

Link copied to clipboard
open suspend override fun unregister(command: MessageCommand<*, *>, delete: Boolean): MessageCommand<*, *>?

Unregister a message command.

open suspend override fun unregister(command: SlashCommand<*, *, *>, delete: Boolean): SlashCommand<*, *, *>?

Unregister a slash command.

open suspend override fun unregister(command: UserCommand<*, *>, delete: Boolean): UserCommand<*, *>?

Unregister a user command.

Link copied to clipboard
open suspend fun unregisterGeneric(command: ApplicationCommand<*>, delete: Boolean = true): ApplicationCommand<*>?

Unregister a generic ApplicationCommand.