From 0f845b03b7daab93e12be764c744f49f95d42822 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 1 Oct 2023 15:47:26 +0600 Subject: [PATCH] initialization of plagubot description --- docs/tgbotapi/plagubot/index.md | 48 ++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/docs/tgbotapi/plagubot/index.md b/docs/tgbotapi/plagubot/index.md index a27108f..7cf55dc 100644 --- a/docs/tgbotapi/plagubot/index.md +++ b/docs/tgbotapi/plagubot/index.md @@ -23,8 +23,10 @@ Bot is initializing with the next algorithm: ```mermaid flowchart TB main["Main"] + Join["Endless join bot work"] subgraph ConfigReading + direction LR ConfigJsonParsing["Parsing to Json"] ConfigParsing["Parsing to global config"] ConfigJsonParsing --> ConfigParsing @@ -34,16 +36,60 @@ flowchart TB BotConstructorCalling["Calling of PlaguBot constructor"] subgraph BotStart + direction TB BotStartKoinAppInit["Initialization of koin app"] subgraph BotStartSetupDI - sample + direction LR + subgraph BotStartSetupDIPutDefaults["Put defaults in DI"] + direction LR + BotStartSetupDIPutDefaultsConfig["Config"] + BotStartSetupDIPutDefaultsPluginsList["Plugins list"] + BotStartSetupDIPutDefaultsDatabaseConfig["Database Config"] + BotStartSetupDIPutDefaultsDefaultJson["Default Json"] + BotStartSetupDIPutDefaultsPlagubot["PlaguBot itself"] + BotStartSetupDIPutDefaultsTelegramBot["TelegramBot"] + end + BotStartSetupDIIncludes["`Synchronous (in queue) registration of all plugins __setupDI__ modules`"] + + BotStartSetupDIPutDefaults --> BotStartSetupDIIncludes end + BotStartKoinAppStart["`Starting of koin application. Since this step all modules from __setupDI__ of plugins will be available`"] + + subgraph BotStartBehaviourContextInitialization["Initialization of behaviour context"] + direction TB + BotStartBehaviourContextInitializationStatesManager["`Get from DI or create default **DefaultStatesManagerRepo**`"] + BotStartBehaviourContextInitializationStatesManagerRepo["`Get from DI or create default **StatesManagerRepo**`"] + BotStartBehaviourContextInitializationStatesManagerUsedCondition{"Is the default one used?"} + BotStartBehaviourContextInitializationOnStartConflictsResolver["Getting of all OnStartContextsConflictResolver"] + BotStartBehaviourContextInitializationOnUpdateConflictsResolver["Getting of all OnUpdateContextsConflictResolver"] + BotStartBehaviourContextInitializationStateHandlingErrorHandler["`Get from DI or create default **StateHandlingErrorHandler**`"] + + subgraph BotStartBehaviourContextInitializationSetupPlugins["Plugins bot functionality init"] + BotStartBehaviourContextInitializationSetupPluginsSetupBotPlugin["`Call **setupBotPlugin** for each plugin`"] + end + + BotStartBehaviourContextInitializationStatesManager --> BotStartBehaviourContextInitializationStatesManagerUsedCondition + BotStartBehaviourContextInitializationStatesManagerUsedCondition --"Yes"--> BotStartBehaviourContextInitializationStatesManagerRepo + BotStartBehaviourContextInitializationStatesManagerUsedCondition --"No"--> BotStartBehaviourContextInitializationStateHandlingErrorHandler + BotStartBehaviourContextInitializationStatesManagerRepo --> BotStartBehaviourContextInitializationOnStartConflictsResolver + BotStartBehaviourContextInitializationOnStartConflictsResolver --> BotStartBehaviourContextInitializationOnUpdateConflictsResolver + BotStartBehaviourContextInitializationOnUpdateConflictsResolver --> BotStartBehaviourContextInitializationStateHandlingErrorHandler + BotStartBehaviourContextInitializationStateHandlingErrorHandler --> BotStartBehaviourContextInitializationSetupPlugins + end + BotStartDeleteWebhook["Delete webhooks"] + BotStartStartLongPolling["Start long polling"] + BotStartKoinAppInit --> BotStartSetupDI + BotStartSetupDI --> BotStartKoinAppStart + BotStartKoinAppStart --> BotStartBehaviourContextInitialization + BotStartBehaviourContextInitialization --> BotStartDeleteWebhook + BotStartDeleteWebhook --> BotStartStartLongPolling end main --> ConfigReading ConfigReading --> BotConstructorCalling BotConstructorCalling --> BotStart + BotStart --> Join ```