CommandsPlugin

object CommandsPlugin : Plugin

This plugin has been created for centralized work with commands in context of Plugins system of plagubot. Pass BotCommandFullInfo in your Plugin.setupDI section to declare some command. You may use CommandsKeeper for flexible setup of commands in runtime.

Functions

Link copied to clipboard
open suspend override fun BehaviourContext.setupBotPlugin(koin: Koin)

Uses CommandsKeeper from koin. Subscribe on CommandsKeeper.scopesCommands to follow changed in scopes and take all the available keys in the CommandsKeeper and set commands for each key

open suspend fun BehaviourContextWithFSM<State>.setupBotPlugin(koin: Koin)
Link copied to clipboard
open override fun Module.setupDI(database: Database, params: JsonObject)

Creating CommandsKeeper and pass it to the DI. It uses org.koin.core.scope.Scope.getAll to get all the BotCommandFullInfo instances declared in the DI.

Sources

Link copied to clipboard