StorageAwareApplicationCommandRegistry

ApplicationCommandRegistry which acts based off a specified storage interface.

Discord lifecycles may not be implemented in this class and require manual updating.

Constructors

Link copied to clipboard
constructor(builder: () -> RegistryStorage<Snowflake, ApplicationCommand<*>>)

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
val ApplicationCommandType.name: String

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

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
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 MessageCommand to the registry.

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

Register a SlashCommand to the registry.

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

Register a UserCommand to the registry.

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 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.