Work In Progress
This documentation is in beta. It's missing lots of content, search is broken, and many links go nowhere. These problems will be fixed before release, but there's plenty of work left!
Skip to main content

Hooks

The hooks { } builder allows you to register blocks of code to be run at various stages of your bot's lifecycle.

Hooks

beforeStart { ... }Receiver: ExtensibleBot

Run during startup, just before the bot's ExtensibleBot object tires to connect to Discord.

This hook will run again if you stop and restart the ExtensibleBot object using the relevant functions.

created { ... }Receiver: ExtensibleBot

Run during startup, right after the bot's ExtensibleBot object has created, and before it has been set up.

setup { ... }Receiver: ExtensibleBot

Run during startup, right after the bot's ExtensibleBot object has been set up.

afterExtensionsAdded { ... }Receiver: ExtensibleBot

Run during startup, after the bot loads any registered extensions.

beforeExtensionsAdded { ... }Receiver: ExtensibleBot

Run during startup, before the bot loads any registered extensions.

extensionAdded { ... }Receiver: ExtensibleBot

Run after an extension is loaded, regardless of where the bot is in its lifecycle.

Lambda Arguments
extensionType: Extension

The extension that was just loaded.

These builders relate to Koin and how Kord Extensions manages it. For more information about Koin (and what we do differently with it), please see [the Koin page].

afterKoinSetup { ... }

Run during startup, after the default Koin modules have been registered.

This is a great place to register any extra Koin modules your bot needs.

beforeKoinSetup { ... }

Run during startup, after Kord Extensions starts Koin, but before the default Koin modules have been registered.

Settings

var kordShutdownHookType: BooleanDefault: true

Whether to register Kord's shutdown hook.

This hook formally disconnects your bot from Discord's gateway when the bot's process shuts down. We don't recommend disabling this unless you run into a serious, related problem.