BContext

@InterfacedService(acceptMultiple = false)
interface BContext(source)

Main context for BotCommands framework.

Types

Link copied to clipboard

Initialization status of the framework.

Properties

Link copied to clipboard

Returns the application commands context, this is for user/message/slash commands and related methods

Link copied to clipboard
Link copied to clipboard
abstract val botOwners: BotOwners

Returns the BotOwners service.

Link copied to clipboard
Link copied to clipboard
abstract val config: BConfig
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Returns the EventDispatcher service.

Link copied to clipboard

Returns the global exception handler, used to handle errors caught by the framework, or null if none exists.

Link copied to clipboard

Returns the help builder consumer - changes the EmbedBuilder given to add more stuff in it

Link copied to clipboard
Link copied to clipboard
open val jda: JDA

Returns the JDA instance associated with this context.

Link copied to clipboard
Link copied to clipboard

Returns the IDs of the bot owners.

Link copied to clipboard
open val prefix: String?

Returns the preferred prefix for triggering this bot, or null if BTextConfig.usePingAsPrefix is disabled and no prefix was added in BTextConfig.prefixes.

Link copied to clipboard
open val prefixes: List<String>

Returns the full list of prefixes used to trigger the bot.

Link copied to clipboard
Link copied to clipboard

Returns the ServiceContainer service.

Link copied to clipboard

Returns the SettingsProvider service, or null if none exists.

Link copied to clipboard
abstract val status: BContext.Status

Returns the initialization status of the framework.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
open fun dispatchException(message: String, t: Throwable?)
abstract fun dispatchException(message: String, t: Throwable?, extraContext: Map<String, Any?>)

Sends an exception message to the bot owners.

Link copied to clipboard

Returns the DefaultMessages instance for this Guild's locale

Returns the DefaultMessages instance for the provided Discord locale.

Returns the DefaultMessages instance for this user's locale

Link copied to clipboard

Returns the DiscordLocale for the specified Guild

Link copied to clipboard
abstract fun getExceptionContent(message: String, t: Throwable?, extraContext: Map<String, Any?>): String

Gets the message that would be sent by dispatchException.

Link copied to clipboard

Filters out interfaced services of that type if they are already being inspected.

Link copied to clipboard

Filters out interfaced services of that type if they are already being inspected.

Link copied to clipboard
open fun <T : Any> getService(clazz: Class<T>): T
Link copied to clipboard
inline fun <T : Any> BContext.getService(): T
fun <T : Any> BContext.getService(kClass: KClass<T>): T
Link copied to clipboard
inline fun <T : Any> BContext.getServiceOrNull(): T?
fun <T : Any> BContext.getServiceOrNull(kClass: KClass<T>): T?
Link copied to clipboard
open fun invalidateAutocompleteCache(autocompleteHandlerName: String)
open fun invalidateAutocompleteCache(autocompleteHandler: KFunction<Collection<Any>>)

Invalidates the autocomplete cache of the specified autocomplete handler.

Link copied to clipboard
open fun isOwner(userId: Long): Boolean

Tells whether this user is an owner or not.

Link copied to clipboard
open fun <T : Any> tryGetService(clazz: Class<T>): ServiceResult<T>
Link copied to clipboard