ChatCommandRegistry

A class for the registration and dispatching of message-based commands.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Current instance of the bot.

Link copied to clipboard

A list of all registered commands.

Link copied to clipboard
open val enabled: Boolean

Whether chat commands are enabled in the bot's settings.

Link copied to clipboard
val kord: Kord

Kord instance, backing the ExtensibleBot.

Link copied to clipboard

Chat command parser object.

Functions

Link copied to clipboard
open fun add(command: ChatCommand<out Arguments>)

Directly register a ChatCommand to this command registry.

Link copied to clipboard
open suspend fun getCommand(name: String, event: MessageCreateEvent): ChatCommand<out Arguments>?

Given a command name and MessageCreateEvent, try to find a matching command.

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

Get the associated Koin instance.

Link copied to clipboard
open suspend fun getPrefix(event: MessageCreateEvent): String

Given a MessageCreateEvent, return the prefix that should be used for a command invocation.

Link copied to clipboard
open suspend fun handleEvent(event: MessageCreateEvent)

Handles an incoming MessageCreateEvent and dispatches a command invocation, if possible.

Link copied to clipboard
open fun remove(command: ChatCommand<out Arguments>): Boolean

Directly remove a registered ChatCommand from this command registry.

Link copied to clipboard

Check whether the given string starts with a mention referring to the bot. If so, the matching mention string is returned, otherwise null.