small docs actualization

This commit is contained in:
InsanusMokrassar 2024-09-23 00:47:59 +06:00
parent c7e552ebb5
commit 6e7cf1cb0e
3 changed files with 43 additions and 4 deletions

View File

@ -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`

View File

@ -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:

View File

@ -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"]