initialization of plagubot description

This commit is contained in:
InsanusMokrassar 2023-10-01 15:47:26 +06:00
parent 655bdf2126
commit 0f845b03b7

View File

@ -23,8 +23,10 @@ Bot is initializing with the next algorithm:
```mermaid ```mermaid
flowchart TB flowchart TB
main["Main"] main["Main"]
Join["Endless join bot work"]
subgraph ConfigReading subgraph ConfigReading
direction LR
ConfigJsonParsing["Parsing to Json"] ConfigJsonParsing["Parsing to Json"]
ConfigParsing["Parsing to global config"] ConfigParsing["Parsing to global config"]
ConfigJsonParsing --> ConfigParsing ConfigJsonParsing --> ConfigParsing
@ -34,16 +36,60 @@ flowchart TB
BotConstructorCalling["Calling of PlaguBot constructor"] BotConstructorCalling["Calling of PlaguBot constructor"]
subgraph BotStart subgraph BotStart
direction TB
BotStartKoinAppInit["Initialization of koin app"] BotStartKoinAppInit["Initialization of koin app"]
subgraph BotStartSetupDI 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 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 BotStartKoinAppInit --> BotStartSetupDI
BotStartSetupDI --> BotStartKoinAppStart
BotStartKoinAppStart --> BotStartBehaviourContextInitialization
BotStartBehaviourContextInitialization --> BotStartDeleteWebhook
BotStartDeleteWebhook --> BotStartStartLongPolling
end end
main --> ConfigReading main --> ConfigReading
ConfigReading --> BotConstructorCalling ConfigReading --> BotConstructorCalling
BotConstructorCalling --> BotStart BotConstructorCalling --> BotStart
BotStart --> Join
``` ```