diff --git a/docs/micro_utils/colors.md b/docs/micro_utils/colors.md index 7bec20d..399b2e4 100644 --- a/docs/micro_utils/colors.md +++ b/docs/micro_utils/colors.md @@ -1,4 +1,6 @@ -# Colors [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/micro_utils.colors.common/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/micro_utils.colors.common) +# Colors + +[![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/micro_utils.colors.common/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/micro_utils.colors.common) * `Group`: `dev.inmo` * `ArtifactId`: `micro_utils.colors.common` diff --git a/docs/micro_utils/startup.md b/docs/micro_utils/startup.md index 78af1ba..773a4b1 100644 --- a/docs/micro_utils/startup.md +++ b/docs/micro_utils/startup.md @@ -1,10 +1,40 @@ -# Startup [![Maven Central](https://img.shields.io/maven-central/v/dev.inmo/micro_utils.common?label=latest_version&style=flat-square)](https://github.com/InsanusMokrassar/MicroUtils) +# Startup + +[![Maven Central](https://img.shields.io/maven-central/v/dev.inmo/micro_utils.common?label=latest_version&style=flat-square)](https://github.com/InsanusMokrassar/MicroUtils) * **Plugins Package**: `dev.inmo:micro_utils.startup.plugin` * **Launcher Package**: `dev.inmo:micro_utils.startup.launcher` This package contains unified simple `Plugin`/`Launcher` tools for separating of your apps parts +Launching logic: + + +```mermaid +flowchart TB + StartLauncherPlugin.startAsync + StartLauncherPlugin.startAsync --> KoinInit["Koin.init"] + KoinInit --> StartLauncherPlugin.setupDI + + + subgraph StartLauncherPlugin.setupDI + direction LR + AddDefaultDependencies["Default dependencies: config as JsonObject, config as object, CoroutineScope, Json"] + SubPluginsSetupDI["Calling setupDI in subplugins"] + AddDefaultDependencies --> SubPluginsSetupDI + end + + StartLauncherPlugin.setupDI --> startKoin + startKoin --> StartLauncherPlugin.startPlugin + + subgraph StartLauncherPlugin.startPlugin + direction LR + LaunchSubplugins["Asynchronously (in CoroutineScope from Koin) start subplugins"] + end + + StartLauncherPlugin.startPlugin --> ReturnKoinAppAndLaunchJob["Return koinApp and laucnhing job"] +``` + ## Plugin To define plugin, you must use `StartPlugin` as supertype for your plugin. Restrictions are simple: plugins must be an `object` or `class` with empty constructor. Basic sample is here: diff --git a/docs/plagubot/index.md b/docs/plagubot/index.md index 7cf55dc..9f421df 100644 --- a/docs/plagubot/index.md +++ b/docs/plagubot/index.md @@ -9,8 +9,10 @@ Plugin is a partially independent part of bot. Plugin have several parts: -* `setupDI` - this method should be used to configure DI part of module -* `setupBotPlugin` - method to start/configure your bot actions +* `setupBotClient` - method to configure telegram bot in case you need it. Called synchronously when `TelegramBot` +initializing in `single` in `setupDI` of `PlaguBot` +* `setupBotPlugin` - method to start/configure your **bot** actions. Called asynchronously in `buildBehaviourWithFSM` +in `startPlugin` of `PlaguBot` Plugin realization should be an `object` or `class` with empty constructor. @@ -20,6 +22,11 @@ Most important of bot is `main` function (full reference: `dev.inmo.plagubot.App Bot is initializing with the next algorithm: + +--- + +**OLD** + ```mermaid flowchart TB main["Main"]