Kord Extensions Help

About

The about builder allows you to configure your bot's about command.

By default, Kord Extensions will create an about chat and slash command, with a copyright subcommand. You can configure this command using the about { } builder, adding your own sections and copyright notices as appropriate.

about { ephemeral = false general { message { locale -> content = "General message content goes here!" } } section("another") { description = "Command description goes here!" message { locale -> content = "More content here!" embed { description = "Maybe even an embed?" } } } }

Configuration

The about { } builder provides the following properties.

Property

Type

Description

ephemeral

Boolean

Whether commands (including the copyright command) should respond to slash commands ephemerally. Defaults to true.

translationBundle

String?

Translation bundle, used to translate your section names and descriptions by default.

Sections

While Kord Extensions provides the copyright subcommand by default, you're free to add any other informational commands you wish. These commands are referred to as "sections," and each section is represented by a subcommand on the about command.

To configure a section, use the section function. This function takes the section name and description as arguments, and provides a builder you can use to configure the section's options and provide a message.

section("name", "description") { bundle = "my-translation-bundle" description = "section description" message { embed { title = "Embed Title" description = translate("a.translation.key") } } }

The about { } builder also provides a general builder, providing a standard "general" section with a translated command name and description.

Builders

Builder

Description

message

Call this DSL function to provide a message builder, used to construct the message returned to the user when they access the current section.

This builder is a receiver against the MessageBuilder type, and takes the current event context's Locale as the first argument. This Locale object can be used with the provided translate function, if you need to use the i18n system.

Properties

Property

Type

Description

ephemeral

Boolean

Whether this section should respond to slash commands ephemerally. If not provided, defaults to the setting provided in the about { } builder.

translationBundle

String?

Translation bundle, used to translate the section name and description. If not provided, defaults to the setting provided in the about { } builder.

Functions

Function

Description

translate

Convenience function providing quick access to the i18n system, allowing translation using the given translation key and locale.

The contents of the copyright section are generated based on a list of copyright entries, provided via the copyright function.

Kord Extensions will automatically populate this list with the following data:

  • The dependencies it uses, along with those used by any first-party modules included with your bot.

  • A list of currently loaded plugins, without versioning information.

Copyright items may be added by calling the copyright function with a name, SPDX license identifier, item type (Framework, Library, Plugin/Module, or Tool), and optionally a URL.

about { copyright( "Time4J", "LGPL-2.1", CopyrightType.Library, "http://time4j.net/" ) }

If you're writing a module, library, or meta-framework, feel free to include whatever information you feel is relevant by default.

A simple way to do this is by creating an extension function, checking a top-level boolean value, and calling this function in a setup function or class initializer. For example:

private var copyrightAdded = false internal fun AboutBuilder.addCopyright() { if (!copyrightAdded) { copyright( "Time4J", "LGPL-2.1", CopyrightType.Library, "http://time4j.net/" ) } copyrightAdded = true } // ... class MyExtension : Extension() { override fun setup() { bot.settings.aboutBuilder.addCopyright() } }
Last modified: 03 September 2024